diff options
author | David Majnemer <david.majnemer@gmail.com> | 2014-10-11 10:19:52 +0000 |
---|---|---|
committer | David Majnemer <david.majnemer@gmail.com> | 2014-10-11 10:19:52 +0000 |
commit | 2af441e26e010e6c4b935d94f03fc8487e75f4b4 (patch) | |
tree | 09f836dae3b1314243edab3b67a720e61cfe01e2 /lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | |
parent | 0b0126955ab2c944599693644c5069e12c90463e (diff) |
InstCombine: mul to shl shouldn't preserve nsw
consider:
mul i32 nsw %x, -2147483648
this instruction will not result in poison if %x is 1
however, if we transform this into:
shl i32 nsw %x, 31
then we will be generating poison because we just shifted into the sign
bit.
This fixes PR21242.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@219566 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms/InstCombine/InstCombineMulDivRem.cpp')
-rw-r--r-- | lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 260b7e7e4fe..249456fa6ea 100644 --- a/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp @@ -176,8 +176,6 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) { if (NewCst) { BinaryOperator *Shl = BinaryOperator::CreateShl(NewOp, NewCst); - if (I.hasNoSignedWrap()) - Shl->setHasNoSignedWrap(); if (I.hasNoUnsignedWrap()) Shl->setHasNoUnsignedWrap(); |