[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
lattner at cs.uiuc.edu
Tue Nov 4 17:38:04 PST 2003
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.137 -> 1.138
---
Log message:
Implement InstCombine/xor.ll:test(15|16)
---
Diffs of the changes: (+8 -1)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.137 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.138
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.137 Sun Nov 2 23:17:03 2003
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Tue Nov 4 17:37:10 2003
@@ -1002,7 +1002,14 @@
SCI->getOperand(0), SCI->getOperand(1));
if (ConstantInt *Op0CI = dyn_cast<ConstantInt>(Op0I->getOperand(1)))
- if (Op0I->getOpcode() == Instruction::And) {
+ if (Op0I->getOpcode() == Instruction::Add) {
+ // ~(X-c) --> (-c-1)-X
+ if (RHS->isAllOnesValue())
+ return BinaryOperator::create(Instruction::Sub,
+ *-*Op0CI -
+ *ConstantInt::get(I.getType(), 1),
+ Op0I->getOperand(0));
+ } else if (Op0I->getOpcode() == Instruction::And) {
// (X & C1) ^ C2 --> (X & C1) | C2 iff (C1&C2) == 0
if ((*RHS & *Op0CI)->isNullValue())
return BinaryOperator::create(Instruction::Or, Op0, RHS);
More information about the llvm-commits
mailing list