summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-01-30 16:53:03 +0000
committerSanjay Patel <spatel@rotateright.com>2017-01-30 16:53:03 +0000
commit8e644c08ee6e921430e1a1f3e9a8b9dab6c0f8f9 (patch)
treec1f9cd5f048efeda94fb0389463cf09da54712eb /llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
parent5d6687da99d945f4b0b1e020b6583515dca530cc (diff)
downloadbcm5719-llvm-8e644c08ee6e921430e1a1f3e9a8b9dab6c0f8f9.tar.gz
bcm5719-llvm-8e644c08ee6e921430e1a1f3e9a8b9dab6c0f8f9.zip
[InstCombine] fixed to propagate 'exact' on lshr
The original shift is bigger, so this may qualify as 'obvious', but here's an attempt at an Alive-based proof: Name: exact Pre: (C1 u< C2) %a = shl i8 %x, C1 %b = lshr exact i8 %a, C2 => %c = lshr exact i8 %x, C2 - C1 %b = and i8 %c, ((1 << width(C1)) - 1) u>> C2 Optimization is correct! llvm-svn: 293498
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
index 6cf64c26172..55b37f0fe62 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -773,7 +773,7 @@ Instruction *InstCombiner::visitLShr(BinaryOperator &I) {
return NewLShr;
}
// (X << C1) >>u C2 --> (X >>u (C2 - C1)) & (-1 >> C2)
- Value *NewLShr = Builder->CreateLShr(X, ShiftDiff);
+ Value *NewLShr = Builder->CreateLShr(X, ShiftDiff, "", I.isExact());
APInt Mask(APInt::getLowBitsSet(BitWidth, BitWidth - ShAmt));
return BinaryOperator::CreateAnd(NewLShr, ConstantInt::get(Ty, Mask));
}
OpenPOWER on IntegriCloud