summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2007-02-03 23:28:07 +0000
committerChris Lattner <sabre@nondot.org>2007-02-03 23:28:07 +0000
commit7f3da2dd13d2c420c22800845486ba5971e37eb0 (patch)
treeae3312d905408e710d0d60b33fdf8ab95d250852 /lib
parent7ba98a90008727e2fa0dfc1787cad71e1b6021eb (diff)
downloadllvm-7f3da2dd13d2c420c22800845486ba5971e37eb0.tar.gz
llvm-7f3da2dd13d2c420c22800845486ba5971e37eb0.tar.bz2
llvm-7f3da2dd13d2c420c22800845486ba5971e37eb0.tar.xz
remove some dead code
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@33845 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/Scalar/InstructionCombining.cpp17
1 files changed, 3 insertions, 14 deletions
diff --git a/lib/Transforms/Scalar/InstructionCombining.cpp b/lib/Transforms/Scalar/InstructionCombining.cpp
index 8f3675299c..49a1775047 100644
--- a/lib/Transforms/Scalar/InstructionCombining.cpp
+++ b/lib/Transforms/Scalar/InstructionCombining.cpp
@@ -5624,25 +5624,14 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
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