diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-09 17:15:04 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-09 17:15:04 +0000 |
commit | 9e4aa0259f65905b4c9ae74b966ae2806c99d07a (patch) | |
tree | a67839f0142cf8fb0cbdece65a9ced200d0a15c9 /llvm/lib/Transforms | |
parent | 206b065afbb600c8405249a5431b8bd6c1ffeeb1 (diff) | |
download | bcm5719-llvm-9e4aa0259f65905b4c9ae74b966ae2806c99d07a.tar.gz bcm5719-llvm-9e4aa0259f65905b4c9ae74b966ae2806c99d07a.zip |
Teach instsimplify some tricks about exact/nuw/nsw shifts.
improve interfaces to instsimplify to take this info.
llvm-svn: 125196
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp b/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp index 988f29e16a4..395d79d5a74 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineShifts.cpp +++ b/llvm/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)) |