aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/ScalarEvolution.cpp
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2016-07-23 00:54:36 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2016-07-23 00:54:36 +0000
commita7d9ec8751b1bb045f83934e9be202a191249db8 (patch)
treeb07580b15999f9534793c29636d0934ca76bd3be /llvm/lib/Analysis/ScalarEvolution.cpp
parent401d031e1e1741c586b46ecd749790e51dcbc8a0 (diff)
downloadllvm-a7d9ec8751b1bb045f83934e9be202a191249db8.zip
llvm-a7d9ec8751b1bb045f83934e9be202a191249db8.tar.gz
llvm-a7d9ec8751b1bb045f83934e9be202a191249db8.tar.bz2
[SCEV] Make isImpliedCondOperandsViaRanges smarter
This change lets us prove things like "{X,+,10} s< 5000" implies "{X+7,+,10} does not sign overflow" It does this by replacing replacing getConstantDifference by computeConstantDifference (which is smarter) in isImpliedCondOperandsViaRanges. llvm-svn: 276505
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp12
1 files changed, 1 insertions, 11 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 89c09a8..d881e81 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -8571,16 +8571,6 @@ ScalarEvolution::isImpliedCondOperandsHelper(ICmpInst::Predicate Pred,
return false;
}
-Optional<APInt> ScalarEvolution::getConstantDifference(const SCEV *LHS,
- const SCEV *RHS) {
- if (const SCEVAddExpr *AddLHS = dyn_cast<SCEVAddExpr>(LHS))
- if (AddLHS->getOperand(1) == RHS)
- if (auto *Addend = dyn_cast<SCEVConstant>(AddLHS->getOperand(0)))
- return Addend->getAPInt();
-
- return None;
-}
-
bool ScalarEvolution::isImpliedCondOperandsViaRanges(ICmpInst::Predicate Pred,
const SCEV *LHS,
const SCEV *RHS,
@@ -8591,7 +8581,7 @@ bool ScalarEvolution::isImpliedCondOperandsViaRanges(ICmpInst::Predicate Pred,
// reduce the compile time impact of this optimization.
return false;
- Optional<APInt> Addend = getConstantDifference(LHS, FoundLHS);
+ Optional<APInt> Addend = computeConstantDifference(LHS, FoundLHS);
if (!Addend)
return false;