summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2016-09-12 16:25:41 +0000
committerSanjay Patel <spatel@rotateright.com>2016-09-12 16:25:41 +0000
commitf5887f1fbdc6d95692e358ef65ea2ea4c80e6050 (patch)
tree15936767271b05746152efbd15a6610baae5f577 /llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
parente58e0e3fe30a961501d63f2bf1c5ee83a493a417 (diff)
downloadbcm5719-llvm-f5887f1fbdc6d95692e358ef65ea2ea4c80e6050.tar.gz
bcm5719-llvm-f5887f1fbdc6d95692e358ef65ea2ea4c80e6050.zip
[InstCombine] use m_APInt to allow icmp X, C folds for splat constant vectors
isSignBitCheck could be changed to take a pointer param to avoid the 'UnusedBit' ugliness. llvm-svn: 281231
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index 3108142397f..6c8eea1f1bc 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -3153,9 +3153,10 @@ Instruction *InstCombiner::foldICmpUsingKnownBits(ICmpInst &I) {
// If this is a normal comparison, it demands all bits. If it is a sign bit
// comparison, it only demands the sign bit.
bool IsSignBit = false;
- if (ConstantInt *CI = dyn_cast<ConstantInt>(Op1)) {
+ const APInt *CmpC;
+ if (match(Op1, m_APInt(CmpC))) {
bool UnusedBit;
- IsSignBit = isSignBitCheck(Pred, CI->getValue(), UnusedBit);
+ IsSignBit = isSignBitCheck(Pred, *CmpC, UnusedBit);
}
APInt Op0KnownZero(BitWidth, 0), Op0KnownOne(BitWidth, 0);
OpenPOWER on IntegriCloud