New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
InstCombine Transform Broken for set[lg]t (cast X to X++), CI #826
Comments
assigned to @lattner |
This testcase may work better: bool %nada(sbyte %X) { Otherwise, instcombine will just delete all of the code. :) In this case, it should be optimized to: bool %nada(sbyte %X) { -Chris |
Potential Patch |
Test Case |
The "Potential Patch" produces the following xform from the "Test Case". I'd bool %lt_signed_to_large_unsigned(sbyte %SB) { |
Okay, the new patch now delivers: bool %lt_signed_to_large_unsigned(sbyte %SB) { bool %lt_signed_to_large_signed(sbyte %SB) { bool %lt_signed_to_large_negative(sbyte %SB) { bool %lt_signed_to_small_unsigned(sbyte %SB) { bool %lt_signed_to_small_signed(sbyte %SB) { bool %lt_signed_to_small_negative(sbyte %SB) { bool %lt_unsigned_to_large_unsigned(ubyte %SB) { bool %lt_unsigned_to_large_signed(ubyte %SB) { bool %lt_unsigned_to_large_negative(ubyte %SB) { bool %lt_unsigned_to_small_unsigned(ubyte %SB) { bool %lt_unsigned_to_small_signed(ubyte %SB) { bool %lt_unsigned_to_small_negative(ubyte %SB) { bool %gt_signed_to_large_unsigned(sbyte %SB) { bool %gt_signed_to_large_signed(sbyte %SB) { bool %gt_signed_to_large_negative(sbyte %SB) { bool %gt_signed_to_small_unsigned(sbyte %SB) { bool %gt_signed_to_small_signed(sbyte %SB) { bool %gt_signed_to_small_negative(sbyte %SB) { bool %gt_unsigned_to_large_unsigned(ubyte %SB) { bool %gt_unsigned_to_large_signed(ubyte %SB) { bool %gt_unsigned_to_large_negative(ubyte %SB) { bool %gt_unsigned_to_small_unsigned(ubyte %SB) { bool %gt_unsigned_to_small_signed(ubyte %SB) { bool %gt_unsigned_to_small_negative(ubyte %SB) { |
Third Potential Patch |
The last patch is currently awaiting results of nightly testing. It will be |
Resolution Patch Is Here: http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041122/021408.html |
Part of this patch was disabled here: It miscompiles the testcase in the commit. -Chris |
This transform was reimplemented and reenabled here: -Chris |
I just want to add a short note that the code contains several shifts in the Maybe it would be a good idea to implement some "uint64_t getHighBit(unsigned |
Excellent point, I'll audit these. Thanks! -Chris |
Yup, there were bugs. Fixed here: Thanks! -Chris |
Extended Description
Currently, the instruction combiner is broken when it tries to eliminate a setcc
with a cast and a constant as an argument under a number of constraints:
The code in question is the switch case starting at InstructionCombining.cpp:2021.
Currently, the optimization has been disabled (leading to performance
degradation of generated code). The disablement was provided by this patch:
http://mail.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20041101/020140.html
This bug aims to fix the pessimization by correctly re-enabling the optimization.
The text was updated successfully, but these errors were encountered: