aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-05-06 02:07:39 +0000
committerChris Lattner <sabre@nondot.org>2005-05-06 02:07:39 +0000
commit7aed7ac5e1767c48941040fabdf2fc8238cdde5b (patch)
treeb599fc56cd8218c88a3b35434f3e8d46f966bd1f
parentd152380ba8a2532177316c3ac9d96804c6e906a3 (diff)
Implement xor.ll:test22
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@21713 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 4d96cbfcce..6824c34552 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -3550,6 +3550,15 @@ Instruction *InstCombiner::visitCastInst(CastInst &CI) {
->getOpcode(), Op0c, Op1c);
}
}
+
+ // cast (xor bool X, true) to int --> xor (cast bool X to int), 1
+ if (SrcBitSize == 1 && SrcI->getOpcode() == Instruction::Xor &&
+ Op1 == ConstantBool::True &&
+ (!Op0->hasOneUse() || !isa<SetCondInst>(Op0))) {
+ Value *New = InsertOperandCastBefore(Op0, DestTy, &CI);
+ return BinaryOperator::createXor(New,
+ ConstantInt::get(CI.getType(), 1));
+ }
break;
case Instruction::Shl:
// Allow changing the sign of the source operand. Do not allow changing