aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-11-22 04:52:55 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-11-22 04:52:55 +0000
commit80c8f627db8c56c5abc7627bc13ace99624c5e63 (patch)
tree8d759e4a1a3e0927b7e3a59bd83f4de26ca3216e /llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
parentfd4a6d2b7aa6fc16f5722ae840867b92ed9c981b (diff)
downloadllvm-80c8f627db8c56c5abc7627bc13ace99624c5e63.zip
llvm-80c8f627db8c56c5abc7627bc13ace99624c5e63.tar.gz
llvm-80c8f627db8c56c5abc7627bc13ace99624c5e63.tar.bz2
InstCombine: Preserve nsw when folding X*(2^C) -> X << C
llvm-svn: 222606
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 7844223..5ea25bf 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -179,6 +179,8 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
if (I.hasNoUnsignedWrap())
Shl->setHasNoUnsignedWrap();
+ if (I.hasNoSignedWrap() && NewCst->isNotMinSignedValue())
+ Shl->setHasNoSignedWrap();
return Shl;
}