summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp')
-rw-r--r--llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
index a2f7fa3c19a..91ea83ec8bc 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCompares.cpp
@@ -2107,8 +2107,10 @@ Instruction *InstCombiner::foldICmpDivConstant(ICmpInst &Cmp,
if (LoOverflow)
return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SLT :
ICmpInst::ICMP_ULT, X, HiBound);
- return replaceInstUsesWith(Cmp, InsertRangeTest(X, LoBound, HiBound,
- DivIsSigned, true));
+ return replaceInstUsesWith(
+ Cmp, insertRangeTest(X, cast<ConstantInt>(LoBound)->getValue(),
+ cast<ConstantInt>(HiBound)->getValue(),
+ DivIsSigned, true));
case ICmpInst::ICMP_NE:
if (LoOverflow && HiOverflow)
return replaceInstUsesWith(Cmp, Builder->getTrue());
@@ -2118,8 +2120,10 @@ Instruction *InstCombiner::foldICmpDivConstant(ICmpInst &Cmp,
if (LoOverflow)
return new ICmpInst(DivIsSigned ? ICmpInst::ICMP_SGE :
ICmpInst::ICMP_UGE, X, HiBound);
- return replaceInstUsesWith(Cmp, InsertRangeTest(X, LoBound, HiBound,
- DivIsSigned, false));
+ return replaceInstUsesWith(
+ Cmp, insertRangeTest(X, cast<ConstantInt>(LoBound)->getValue(),
+ cast<ConstantInt>(HiBound)->getValue(),
+ DivIsSigned, false));
case ICmpInst::ICMP_ULT:
case ICmpInst::ICMP_SLT:
if (LoOverflow == +1) // Low bound is greater than input range.
OpenPOWER on IntegriCloud