InstCombine: Preserve nsw when folding X*(2^C) -> X << C

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@222606 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
David Majnemer
2014-11-22 04:52:55 +00:00
parent 156d6ec86b
commit fc1c5babaf
3 changed files with 7 additions and 5 deletions

View File

@@ -179,6 +179,8 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
if (I.hasNoUnsignedWrap())
Shl->setHasNoUnsignedWrap();
if (I.hasNoSignedWrap() && NewCst->isNotMinSignedValue())
Shl->setHasNoSignedWrap();
return Shl;
}