aboutsummaryrefslogtreecommitdiff
path: root/lib/Transforms
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-08-20 18:24:26 +0000
committerChris Lattner <sabre@nondot.org>2002-08-20 18:24:26 +0000
commit05bd1b2eee9742e7b7d69ceaac321bc8f1020295 (patch)
tree1bc55dca6f110dde2bbd06aa2a036124bf5f66ad /lib/Transforms
parente825bde1255a55d004a4c1f6cadf2ab68c3eef52 (diff)
- instcombine (~(a < b)) into (a >= b)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@3406 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 71c2cc6e3f..30e143dec4 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -328,10 +328,18 @@ Instruction *InstCombiner::visitXor(BinaryOperator &I) {
if (Op1C->isNullValue())
return ReplaceInstUsesWith(I, Op0);
- // xor (xor X, -1), -1 = not (not X) = X
- if (Op1C->isAllOnesValue())
+ // Is this a "NOT" instruction?
+ if (Op1C->isAllOnesValue()) {
+ // xor (xor X, -1), -1 = not (not X) = X
if (Value *X = dyn_castNotInst(Op0))
return ReplaceInstUsesWith(I, X);
+
+ // xor (setcc A, B), true = not (setcc A, B) = setncc A, B
+ if (SetCondInst *SCI = dyn_cast<SetCondInst>(Op0))
+ if (SCI->use_size() == 1)
+ return new SetCondInst(SCI->getInverseCondition(),
+ SCI->getOperand(0), SCI->getOperand(1));
+ }
}
return Changed ? &I : 0;