1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-24 11:42:57 +01:00

Add a complex missed optimization opportunity I came across while investigating

bug 5438.

llvm-svn: 88855
This commit is contained in:
Nick Lewycky 2009-11-15 17:51:23 +00:00
parent c672c34d7a
commit b73208f294

View File

@ -1719,3 +1719,18 @@ static int foo(const char *X) { return strlen(X); }
int bar() { return foo("abcd"); }
//===---------------------------------------------------------------------===//
InstCombine should use SimplifyDemandedBits to remove the or instruction:
define i1 @test(i8 %x, i8 %y) {
%A = or i8 %x, 1
%B = icmp ugt i8 %A, 3
ret i1 %B
}
Currently instcombine calls SimplifyDemandedBits with either all bits or just
the sign bit, if the comparison is obviously a sign test. In this case, we only
need all but the bottom two bits from %A, and if we gave that mask to SDB it
would delete the or instruction for us.
//===---------------------------------------------------------------------===//