[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp

Chris Lattner lattner at cs.uiuc.edu
Sat Apr 1 14:05:14 PST 2006



Changes in directory llvm/lib/Transforms/Scalar:

InstructionCombining.cpp updated: 1.457 -> 1.458
---
Log message:

Fix InstCombine/2006-04-01-InfLoop.ll


---
Diffs of the changes:  (+2 -1)

 InstructionCombining.cpp |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)


Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.457 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.458
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.457	Sat Apr  1 02:03:55 2006
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp	Sat Apr  1 16:05:01 2006
@@ -3008,7 +3008,8 @@
     } else if (Op0I->getOpcode() == Instruction::And && Op0I->hasOneUse()) {
       if (Op0I->getOperand(0) == Op1)                      // (A&B)^A -> (B&A)^A
         Op0I->swapOperands();
-      if (Op0I->getOperand(1) == Op1) {                    // (B&A)^A == ~B & A
+      if (Op0I->getOperand(1) == Op1 &&                    // (B&A)^A == ~B & A
+          !isa<ConstantInt>(Op1)) {  // Canonical form is (B&C)^C
         Instruction *N = BinaryOperator::createNot(Op0I->getOperand(0), "tmp");
         InsertNewInstBefore(N, I);
         return BinaryOperator::createAnd(N, Op1);






More information about the llvm-commits mailing list