diff options
author | Sanjay Patel <spatel@rotateright.com> | 2016-11-27 21:07:28 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2016-11-27 21:07:28 +0000 |
commit | 8ca30ab0c5daf44bc6e86c257ecb5da01345fc28 (patch) | |
tree | ff6cca4efcc25d473b19e902fd1dcda14ac39070 /llvm/lib/Transforms | |
parent | 4fab487265a1014485acab935c75f6e584282ffc (diff) | |
download | bcm5719-llvm-8ca30ab0c5daf44bc6e86c257ecb5da01345fc28.tar.gz bcm5719-llvm-8ca30ab0c5daf44bc6e86c257ecb5da01345fc28.zip |
[InstSimplify] allow integer vector types to use computeKnownBits
Note that the non-splat lshr+lshr test folded, but that does not
work in general. Something is missing or wrong in computeKnownBits
as the non-splat shl+shl test still shows.
llvm-svn: 288005
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index 5181d233d06..95f06f2081d 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp @@ -580,13 +580,13 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, Constant *Op1, // Check for (X << c1) << c2 and (X >> c1) >> c2 if (I.getOpcode() == ShiftOp->getOpcode()) { - uint32_t AmtSum = ShiftAmt1+ShiftAmt2; // Fold into one big shift. - // If this is oversized composite shift, then unsigned shifts get 0, ashr - // saturates. + uint32_t AmtSum = ShiftAmt1 + ShiftAmt2; // Fold into one big shift. + // If this is an oversized composite shift, then unsigned shifts become + // zero (handled in InstSimplify) and ashr saturates. if (AmtSum >= TypeBits) { if (I.getOpcode() != Instruction::AShr) - return replaceInstUsesWith(I, Constant::getNullValue(I.getType())); - AmtSum = TypeBits-1; // Saturate to 31 for i32 ashr. + return nullptr; + AmtSum = TypeBits - 1; // Saturate to 31 for i32 ashr. } return BinaryOperator::Create(I.getOpcode(), X, |