aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2006-04-01 22:05:01 +0000
committerChris Lattner <sabre@nondot.org>2006-04-01 22:05:01 +0000
commitae1ab3989cc9194bd6536ce95aca60452584b7ff (patch)
treeafc0a7eb6adb830b6fa761ed4fc592d4257cc45d
parentff1a14aba93f0a2bbddee84d4d083fae9d516f73 (diff)
Fix InstCombine/2006-04-01-InfLoop.ll
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@27330 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index ecdb62b975..c5c2a5e3c5 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -3008,7 +3008,8 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
} 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);