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 | 3cac85e07120f0cfcbc8e78a975f68ae99fcebbb (patch) | |
tree | 6b590d8c05b0e370555c062d397467af8cb3d12a /llvm/lib/Transforms | |
parent | 686de24128d5abf2c2bde4a99c6639c98f8ec7f0 (diff) | |
download | bcm5719-llvm-3cac85e07120f0cfcbc8e78a975f68ae99fcebbb.tar.gz bcm5719-llvm-3cac85e07120f0cfcbc8e78a975f68ae99fcebbb.zip |
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.
llvm-svn: 219566
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp | 2 |
1 files changed, 0 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp index 260b7e7e4fe..249456fa6ea 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp +++ b/llvm/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(); |