summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/Scalar/SCCP.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/Scalar/SCCP.cpp')
-rw-r--r--llvm/lib/Transforms/Scalar/SCCP.cpp7
1 files changed, 1 insertions, 6 deletions
diff --git a/llvm/lib/Transforms/Scalar/SCCP.cpp b/llvm/lib/Transforms/Scalar/SCCP.cpp
index 329c7570b45..da8b6cfda5f 100644
--- a/llvm/lib/Transforms/Scalar/SCCP.cpp
+++ b/llvm/lib/Transforms/Scalar/SCCP.cpp
@@ -1644,12 +1644,7 @@ static bool tryToReplaceWithConstantRange(SCCPSolver &Solver, Value *V) {
ValueLatticeElement A = getIcmpLatticeValue(Icmp->getOperand(0));
ValueLatticeElement B = getIcmpLatticeValue(Icmp->getOperand(1));
- Constant *C = nullptr;
- if (A.satisfiesPredicate(Icmp->getPredicate(), B))
- C = ConstantInt::getTrue(Icmp->getType());
- else if (A.satisfiesPredicate(Icmp->getInversePredicate(), B))
- C = ConstantInt::getFalse(Icmp->getType());
-
+ Constant *C = A.getCompare(Icmp->getPredicate(), Icmp->getType(), B);
if (C) {
Icmp->replaceAllUsesWith(C);
DEBUG(dbgs() << "Replacing " << *Icmp << " with " << *C
OpenPOWER on IntegriCloud