summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis
diff options
context:
space:
mode:
authorSanjoy Das <sanjoy@playingwithpointers.com>2015-10-08 03:46:00 +0000
committerSanjoy Das <sanjoy@playingwithpointers.com>2015-10-08 03:46:00 +0000
commit10dffcb36b3c5c0c2b48c4043ec324d29a4cd765 (patch)
tree6ab69a16eab0441f4405401126c8af58cfb687a3 /llvm/lib/Analysis
parent1195dbee661f85e6d0d13725c8db947ce1e42d2a (diff)
downloadbcm5719-llvm-10dffcb36b3c5c0c2b48c4043ec324d29a4cd765.tar.gz
bcm5719-llvm-10dffcb36b3c5c0c2b48c4043ec324d29a4cd765.zip
[SCEV] Check `Pred` first in isKnownPredicateViaSplitting
Comparing `Pred` with `ICmpInst::ICMP_ULT` is cheaper that memory access -- do that check before loading / storing `ProvingSplitPredicate`. llvm-svn: 249654
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r--llvm/lib/Analysis/ScalarEvolution.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index fbf6985916c..05c1c6980cb 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -7132,7 +7132,7 @@ ScalarEvolution::isKnownPredicateWithRanges(ICmpInst::Predicate Pred,
bool ScalarEvolution::isKnownPredicateViaSplitting(ICmpInst::Predicate Pred,
const SCEV *LHS,
const SCEV *RHS) {
- if (ProvingSplitPredicate)
+ if (Pred != ICmpInst::ICMP_ULT || ProvingSplitPredicate)
return false;
// Allowing arbitrary number of activations of isKnownPredicateViaSplitting on
@@ -7146,7 +7146,7 @@ bool ScalarEvolution::isKnownPredicateViaSplitting(ICmpInst::Predicate Pred,
// expensive; and using isKnownNonNegative(RHS) is sufficient for most of the
// interesting cases seen in practice. We can consider "upgrading" L >= 0 to
// use isKnownPredicate later if needed.
- if (Pred == ICmpInst::ICMP_ULT && isKnownNonNegative(RHS) &&
+ if (isKnownNonNegative(RHS) &&
isKnownPredicate(CmpInst::ICMP_SGE, LHS, getZero(LHS->getType())) &&
isKnownPredicate(CmpInst::ICMP_SLT, LHS, RHS))
return true;
OpenPOWER on IntegriCloud