summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@gmail.com>2017-06-27 19:57:53 +0000
committerCraig Topper <craig.topper@gmail.com>2017-06-27 19:57:53 +0000
commit5fe0197622109d8ed51569258c19aaaa4214bbeb (patch)
treea17ce8a777166bc3afeaaa44033def217b8e1fc3 /llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
parentccbb8107764528f0405145fbcbb6eed84fd3f87a (diff)
downloadbcm5719-llvm-5fe0197622109d8ed51569258c19aaaa4214bbeb.tar.gz
bcm5719-llvm-5fe0197622109d8ed51569258c19aaaa4214bbeb.zip
[InstCombine] Propagate nsw flag when turning mul by pow2 into shift when the constant is a vector splat or the scalar bit width is larger than 64-bits
The check to see if we can propagate the nsw flag used m_ConstantInt(uint64_t*&) which doesn't work with splat vectors and has a restriction that the bitwidth of the ConstantInt must be 64-bits are less. This patch changes it to use m_APInt to remove both these issues Differential Revision: https://reviews.llvm.org/D34699 llvm-svn: 306457
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
index 365c4ba7515..579639a6194 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp
@@ -227,8 +227,8 @@ Instruction *InstCombiner::visitMul(BinaryOperator &I) {
if (I.hasNoUnsignedWrap())
Shl->setHasNoUnsignedWrap();
if (I.hasNoSignedWrap()) {
- uint64_t V;
- if (match(NewCst, m_ConstantInt(V)) && V != Width - 1)
+ const APInt *V;
+ if (match(NewCst, m_APInt(V)) && *V != Width - 1)
Shl->setHasNoSignedWrap();
}
OpenPOWER on IntegriCloud