[llvm-commits] CVS: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
Chris Lattner
sabre at nondot.org
Sat Feb 3 15:28:23 PST 2007
Changes in directory llvm/lib/Transforms/Scalar:
InstructionCombining.cpp updated: 1.623 -> 1.624
---
Log message:
remove some dead code
---
Diffs of the changes: (+3 -14)
InstructionCombining.cpp | 17 +++--------------
1 files changed, 3 insertions(+), 14 deletions(-)
Index: llvm/lib/Transforms/Scalar/InstructionCombining.cpp
diff -u llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.623 llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.624
--- llvm/lib/Transforms/Scalar/InstructionCombining.cpp:1.623 Fri Feb 2 08:41:37 2007
+++ llvm/lib/Transforms/Scalar/InstructionCombining.cpp Sat Feb 3 17:28:07 2007
@@ -5624,25 +5624,14 @@
unsigned ShiftAmt2 = (unsigned)Op1->getZExtValue();
// Check for (A << c1) << c2 and (A >> c1) >> c2.
- if (isLeftShift == isShiftOfLeftShift) {
- // Do not fold these shifts if the first one is signed and the second one
- // is unsigned and this is a right shift. Further, don't do any folding
- // on them.
- if (isShiftOfSignedShift && isUnsignedShift && !isLeftShift)
- return 0;
-
+ if (I.getOpcode() == ShiftOp->getOpcode()) {
unsigned Amt = ShiftAmt1+ShiftAmt2; // Fold into one big shift.
if (Amt > Op0->getType()->getPrimitiveSizeInBits())
Amt = Op0->getType()->getPrimitiveSizeInBits();
Value *Op = ShiftOp->getOperand(0);
- BinaryOperator *ShiftResult =
- BinaryOperator::create(I.getOpcode(), Op,
- ConstantInt::get(Op->getType(), Amt));
- if (I.getType() == ShiftResult->getType())
- return ShiftResult;
- InsertNewInstBefore(ShiftResult, I);
- return CastInst::create(Instruction::BitCast, ShiftResult, I.getType());
+ return BinaryOperator::create(I.getOpcode(), Op,
+ ConstantInt::get(Op->getType(), Amt));
}
// Check for (A << c1) >> c2 or (A >> c1) << c2. If we are dealing with
More information about the llvm-commits
mailing list