summaryrefslogtreecommitdiff
path: root/lib/Transforms/InstCombine/InstCombineShifts.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-09 17:15:04 +0000
committerChris Lattner <sabre@nondot.org>2011-02-09 17:15:04 +0000
commit81a0dc911586c77421c2255aa417dc9b350b9e20 (patch)
treef6a7b1c0a47ed7fa813cb89a3c0f5d48923bbdf5 /lib/Transforms/InstCombine/InstCombineShifts.cpp
parent6bfd77e3158b10861c76529492eae24a573390a8 (diff)
downloadllvm-81a0dc911586c77421c2255aa417dc9b350b9e20.tar.gz
llvm-81a0dc911586c77421c2255aa417dc9b350b9e20.tar.bz2
llvm-81a0dc911586c77421c2255aa417dc9b350b9e20.tar.xz
Teach instsimplify some tricks about exact/nuw/nsw shifts.
improve interfaces to instsimplify to take this info. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125196 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineShifts.cpp')
-rw-r--r--lib/Transforms/InstCombine/InstCombineShifts.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineShifts.cpp b/lib/Transforms/InstCombine/InstCombineShifts.cpp
index 988f29e16a..395d79d5a7 100644
--- a/lib/Transforms/InstCombine/InstCombineShifts.cpp
+++ b/lib/Transforms/InstCombine/InstCombineShifts.cpp
@@ -617,13 +617,16 @@ Instruction *InstCombiner::FoldShiftByConstant(Value *Op0, ConstantInt *Op1,
}
Instruction *InstCombiner::visitShl(BinaryOperator &I) {
- if (Value *V = SimplifyShlInst(I.getOperand(0), I.getOperand(1), TD))
+ if (Value *V = SimplifyShlInst(I.getOperand(0), I.getOperand(1),
+ I.hasNoSignedWrap(), I.hasNoUnsignedWrap(),
+ TD))
return ReplaceInstUsesWith(I, V);
return commonShiftTransforms(I);
}
Instruction *InstCombiner::visitLShr(BinaryOperator &I) {
- if (Value *V = SimplifyLShrInst(I.getOperand(0), I.getOperand(1), TD))
+ if (Value *V = SimplifyLShrInst(I.getOperand(0), I.getOperand(1),
+ I.isExact(), TD))
return ReplaceInstUsesWith(I, V);
if (Instruction *R = commonShiftTransforms(I))
@@ -652,7 +655,8 @@ Instruction *InstCombiner::visitLShr(BinaryOperator &I) {
}
Instruction *InstCombiner::visitAShr(BinaryOperator &I) {
- if (Value *V = SimplifyAShrInst(I.getOperand(0), I.getOperand(1), TD))
+ if (Value *V = SimplifyAShrInst(I.getOperand(0), I.getOperand(1),
+ I.isExact(), TD))
return ReplaceInstUsesWith(I, V);
if (Instruction *R = commonShiftTransforms(I))