From 6cf4914fd4735a1eab97e3f53bba66e51c627c6c Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Sat, 1 Apr 2006 22:05:01 +0000 Subject: [PATCH] Fix InstCombine/2006-04-01-InfLoop.ll llvm-svn: 27330 --- llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index ecdb62b97570..c5c2a5e3c57a 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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(Op1)) { // Canonical form is (B&C)^C Instruction *N = BinaryOperator::createNot(Op0I->getOperand(0), "tmp"); InsertNewInstBefore(N, I); return BinaryOperator::createAnd(N, Op1);