summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/InstCombine')
-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