[llvm-commits] [llvm] r171310 - in /llvm/trunk: lib/Transforms/InstCombine/InstCombineAndOrXor.cpp test/Transforms/InstCombine/icmp.ll

Jakub Staszak kubastaszak at gmail.com
Mon Dec 31 10:26:42 PST 2012


Author: kuba
Date: Mon Dec 31 12:26:42 2012
New Revision: 171310

URL: http://llvm.org/viewvc/llvm-project?rev=171310&view=rev
Log:
Add extra CHECK to make sure that 'or' instruction was replaced.
Also add an assert to avoid confusion in the code where is known that C1 <= C2.

Modified:
    llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
    llvm/trunk/test/Transforms/InstCombine/icmp.ll

Modified: llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp?rev=171310&r1=171309&r2=171310&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp (original)
+++ llvm/trunk/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp Mon Dec 31 12:26:42 2012
@@ -1528,6 +1528,8 @@
       if (LHS->getOperand(0) == RHS->getOperand(0)) {
         // if LHSCst and RHSCst differ only by one bit:
         // (A == C1 || A == C2) -> (A & ~(C1 ^ C2)) == C1
+        assert(LHSCst->getValue().ule(LHSCst->getValue()));
+
         APInt Xor = LHSCst->getValue() ^ RHSCst->getValue();
         if (Xor.isPowerOf2()) {
           Value *NegCst = Builder->getInt(~Xor);

Modified: llvm/trunk/test/Transforms/InstCombine/icmp.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp.ll?rev=171310&r1=171309&r2=171310&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp.ll Mon Dec 31 12:26:42 2012
@@ -699,6 +699,7 @@
 ; CHECK: @test69
 ; CHECK: %1 = and i32 %c, -33
 ; CHECK: %2 = icmp eq i32 %1, 65
+; CHECK: ret i1 %2
 define i1 @test69(i32 %c) nounwind uwtable {
   %1 = icmp eq i32 %c, 97
   %2 = icmp eq i32 %c, 65





More information about the llvm-commits mailing list