From: Sanjoy Das Date: Thu, 8 Oct 2015 03:46:00 +0000 (+0000) Subject: [SCEV] Check `Pred` first in isKnownPredicateViaSplitting X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=1f802826f7d4a9f95ad058193fbb4ff5e30bb699;p=oota-llvm.git [SCEV] Check `Pred` first in isKnownPredicateViaSplitting Comparing `Pred` with `ICmpInst::ICMP_ULT` is cheaper that memory access -- do that check before loading / storing `ProvingSplitPredicate`. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@249654 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index fbf6985916c..05c1c6980cb 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/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;