diff options
| author | Chris Lattner <sabre@nondot.org> | 2002-08-20 18:24:26 +0000 |
|---|---|---|
| committer | Chris Lattner <sabre@nondot.org> | 2002-08-20 18:24:26 +0000 |
| commit | b8d6e40ed7e307775cb866903a1caccc0effbcd5 (patch) | |
| tree | 14977066fac8a3cbd37347ba9a683ed3b4a0d8d6 /llvm/lib/Transforms | |
| parent | dcf53552ce7b533bc27ffb7a94fa9231dcd13c79 (diff) | |
| download | bcm5719-llvm-b8d6e40ed7e307775cb866903a1caccc0effbcd5.tar.gz bcm5719-llvm-b8d6e40ed7e307775cb866903a1caccc0effbcd5.zip | |
- instcombine (~(a < b)) into (a >= b)
llvm-svn: 3406
Diffstat (limited to 'llvm/lib/Transforms')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/InstructionCombining.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp b/llvm/lib/Transforms/Scalar/InstructionCombining.cpp index 71c2cc6e3f5..30e143dec46 100644 --- a/llvm/lib/Transforms/Scalar/InstructionCombining.cpp +++ b/llvm/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; |

