summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-08-04 22:19:27 +0000
committerSanjay Patel <spatel@rotateright.com>2016-08-04 22:19:27 +0000
commit3bade138b5edb59a472996aeb21fdf9b29d98209 (patch)
treefc8b730d9979a48508fd65df90cd444c3f493283 /llvm/lib/Transforms
parent8daab7582bef4e5d887fc214c9f64dfee122349e (diff)
downloadbcm5719-llvm-3bade138b5edb59a472996aeb21fdf9b29d98209.tar.gz
bcm5719-llvm-3bade138b5edb59a472996aeb21fdf9b29d98209.zip
[InstCombine] use m_APInt to allow icmp eq (mul X, C1), C2 folds for splat constant vectors
This concludes the splat vector enhancements for foldICmpEqualityWithConstant(). Other commits in this series: https://reviews.llvm.org/rL277762 https://reviews.llvm.org/rL277752 https://reviews.llvm.org/rL277738 https://reviews.llvm.org/rL277731 https://reviews.llvm.org/rL277659 https://reviews.llvm.org/rL277638 https://reviews.llvm.org/rL277629 llvm-svn: 277779
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 6c795db6669..778a75fb977 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2314,14 +2314,13 @@ Instruction *InstCombiner::foldICmpEqualityWithConstant(ICmpInst &ICI) {
}
case Instruction::Mul:
if (*RHSV == 0 && BO->hasNoSignedWrap()) {
- // FIXME: Vectors are excluded by ConstantInt.
- if (ConstantInt *BOC = dyn_cast<ConstantInt>(BOp1)) {
- // The trivial case (mul X, 0) is handled by InstSimplify
+ const APInt *BOC;
+ if (match(BOp1, m_APInt(BOC)) && *BOC != 0) {
+ // The trivial case (mul X, 0) is handled by InstSimplify.
// General case : (mul X, C) != 0 iff X != 0
// (mul X, C) == 0 iff X == 0
- if (!BOC->isZero())
- return new ICmpInst(ICI.getPredicate(), BOp0,
- Constant::getNullValue(RHS->getType()));
+ return new ICmpInst(ICI.getPredicate(), BOp0,
+ Constant::getNullValue(RHS->getType()));
}
}
break;
OpenPOWER on IntegriCloud