[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
sabre at nondot.org
Sun Apr 1 22:36:39 PDT 2007
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.718 -> 1.719
---
Log message:
simplify (x+c)^signbit as (x+c+signbit), pointed out by PR1288: http://llvm.org/PR1288 . This implements
test/Transforms/InstCombine/xor.ll:test28
---
Diffs of the changes: (+7 -1)
InstructionCombining.cpp | 8 +++++++-
1 files changed, 7 insertions(+), 1 deletion(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.718 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.719
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.718 Sun Apr 1 15:57:36 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Mon Apr 2 00:36:22 2007
@@ -4005,7 +4005,7 @@
return BinaryOperator::createOr(Op0NotVal, NotY);
}
}
-
+
if (ConstantInt *Op0CI = dyn_cast<ConstantInt>(Op0I->getOperand(1)))
if (Op0I->getOpcode() == Instruction::Add) {
// ~(X-c) --> (-c-1)-X
@@ -4015,6 +4015,12 @@
ConstantExpr::getSub(NegOp0CI,
ConstantInt::get(I.getType(), 1)),
Op0I->getOperand(0));
+ } else if (RHS->getValue().isMinSignedValue()) {
+ // (X + C) ^ signbit -> (X + C + signbit)
+ Constant *C = ConstantInt::get(RHS->getValue() + Op0CI->getValue());
+ return BinaryOperator::createAdd(Op0I->getOperand(0), C);
+
+
}
} else if (Op0I->getOpcode() == Instruction::Or) {
// (X|C1)^C2 -> X^(C1|C2) iff X&~C1 == 0
More information about the llvm-commits
mailing list