summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
diff options
context:
space:
mode:
authorMatt Arsenault <Matthew.Arsenault@amd.com>2014-04-23 16:48:40 +0000
committerMatt Arsenault <Matthew.Arsenault@amd.com>2014-04-23 16:48:40 +0000
commit6b4bed4b8387755b7eea43642ef5d47e4815ead3 (patch)
treef1de709782a5c437134d81c95aff5a0f22604449 /llvm/lib/Transforms/InstCombine
parentfe65998777405354fd3d1551a5ec196fa8afbda3 (diff)
downloadbcm5719-llvm-6b4bed4b8387755b7eea43642ef5d47e4815ead3.tar.gz
bcm5719-llvm-6b4bed4b8387755b7eea43642ef5d47e4815ead3.zip
Remove dead code in instcombine.
Don't replace shifts greater than the type with the maximum shift. This isn't hit anywhere in the tests, and somewhere else is replacing these with undef. llvm-svn: 207000
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
index 1eaff16c593..1f98a0d22e1 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -337,21 +337,12 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, Constant *Op1,
GetShiftedValue(Op0, COp1->getZExtValue(), isLeftShift, *this));
}
-
// See if we can simplify any instructions used by the instruction whose sole
// purpose is to compute bits we don't care about.
uint32_t TypeBits = Op0->getType()->getScalarSizeInBits();
- // shl i32 X, 32 = 0 and srl i8 Y, 9 = 0, ... just don't eliminate
- // a signed shift.
- //
- if (COp1->uge(TypeBits)) {
- if (I.getOpcode() != Instruction::AShr)
- return ReplaceInstUsesWith(I, Constant::getNullValue(Op0->getType()));
- // ashr i32 X, 32 --> ashr i32 X, 31
- I.setOperand(1, ConstantInt::get(I.getType(), TypeBits-1));
- return &I;
- }
+ assert(!COp1->uge(TypeBits) &&
+ "Shift over the type width should have been removed already");
// ((X*C1) << C2) == (X * (C1 << C2))
if (BinaryOperator *BO = dyn_cast<BinaryOperator>(Op0))
OpenPOWER on IntegriCloud