diff --git a/include/llvm/Analysis/ScalarEvolution.h b/include/llvm/Analysis/ScalarEvolution.h index fa6b9ab9675..229a798beb0 100644 --- a/include/llvm/Analysis/ScalarEvolution.h +++ b/include/llvm/Analysis/ScalarEvolution.h @@ -1591,8 +1591,8 @@ private: /// Test whether the condition described by Pred, LHS, and RHS is true. /// Use only simple non-recursive types of checks, such as range analysis etc. - bool isKnownViaSimpleReasoning(ICmpInst::Predicate Pred, - const SCEV *LHS, const SCEV *RHS); + bool isKnownViaNonRecursiveReasoning(ICmpInst::Predicate Pred, + const SCEV *LHS, const SCEV *RHS); /// Test whether the condition described by Pred, LHS, and RHS is true /// whenever the condition described by Pred, FoundLHS, and FoundRHS is diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index b3ab693acac..279417cb1ab 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -8694,7 +8694,7 @@ bool ScalarEvolution::isKnownPredicate(ICmpInst::Predicate Pred, return true; // Otherwise see what can be done with some simple reasoning. - return isKnownViaSimpleReasoning(Pred, LHS, RHS); + return isKnownViaNonRecursiveReasoning(Pred, LHS, RHS); } bool ScalarEvolution::isMonotonicPredicate(const SCEVAddRecExpr *LHS, @@ -8961,7 +8961,7 @@ ScalarEvolution::isLoopBackedgeGuardedByCond(const Loop *L, // (interprocedural conditions notwithstanding). if (!L) return true; - if (isKnownViaSimpleReasoning(Pred, LHS, RHS)) + if (isKnownViaNonRecursiveReasoning(Pred, LHS, RHS)) return true; BasicBlock *Latch = L->getLoopLatch(); @@ -9072,7 +9072,7 @@ ScalarEvolution::isLoopEntryGuardedByCond(const Loop *L, assert(isAvailableAtLoopEntry(RHS, L) && "RHS is not available at Loop Entry"); - if (isKnownViaSimpleReasoning(Pred, LHS, RHS)) + if (isKnownViaNonRecursiveReasoning(Pred, LHS, RHS)) return true; // If we cannot prove strict comparison (e.g. a > b), maybe we can prove @@ -9087,9 +9087,9 @@ ScalarEvolution::isLoopEntryGuardedByCond(const Loop *L, if (ProvingStrictComparison) { ProvedNonStrictComparison = - isKnownViaSimpleReasoning(NonStrictPredicate, LHS, RHS); + isKnownViaNonRecursiveReasoning(NonStrictPredicate, LHS, RHS); ProvedNonEquality = - isKnownViaSimpleReasoning(ICmpInst::ICMP_NE, LHS, RHS); + isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_NE, LHS, RHS); if (ProvedNonStrictComparison && ProvedNonEquality) return true; } @@ -9644,7 +9644,7 @@ bool ScalarEvolution::isImpliedViaOperations(ICmpInst::Predicate Pred, // Is the SGT predicate can be proved trivially or using the found context. auto IsSGTViaContext = [&](const SCEV *S1, const SCEV *S2) { - return isKnownViaSimpleReasoning(ICmpInst::ICMP_SGT, S1, S2) || + return isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SGT, S1, S2) || isImpliedViaOperations(ICmpInst::ICMP_SGT, S1, S2, OrigFoundLHS, FoundRHS, Depth + 1); }; @@ -9749,7 +9749,7 @@ bool ScalarEvolution::isImpliedViaOperations(ICmpInst::Predicate Pred, } bool -ScalarEvolution::isKnownViaSimpleReasoning(ICmpInst::Predicate Pred, +ScalarEvolution::isKnownViaNonRecursiveReasoning(ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS) { return isKnownPredicateViaConstantRanges(Pred, LHS, RHS) || IsKnownPredicateViaMinOrMax(*this, Pred, LHS, RHS) || @@ -9771,26 +9771,26 @@ ScalarEvolution::isImpliedCondOperandsHelper(ICmpInst::Predicate Pred, break; case ICmpInst::ICMP_SLT: case ICmpInst::ICMP_SLE: - if (isKnownViaSimpleReasoning(ICmpInst::ICMP_SLE, LHS, FoundLHS) && - isKnownViaSimpleReasoning(ICmpInst::ICMP_SGE, RHS, FoundRHS)) + if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SLE, LHS, FoundLHS) && + isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SGE, RHS, FoundRHS)) return true; break; case ICmpInst::ICMP_SGT: case ICmpInst::ICMP_SGE: - if (isKnownViaSimpleReasoning(ICmpInst::ICMP_SGE, LHS, FoundLHS) && - isKnownViaSimpleReasoning(ICmpInst::ICMP_SLE, RHS, FoundRHS)) + if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SGE, LHS, FoundLHS) && + isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_SLE, RHS, FoundRHS)) return true; break; case ICmpInst::ICMP_ULT: case ICmpInst::ICMP_ULE: - if (isKnownViaSimpleReasoning(ICmpInst::ICMP_ULE, LHS, FoundLHS) && - isKnownViaSimpleReasoning(ICmpInst::ICMP_UGE, RHS, FoundRHS)) + if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_ULE, LHS, FoundLHS) && + isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_UGE, RHS, FoundRHS)) return true; break; case ICmpInst::ICMP_UGT: case ICmpInst::ICMP_UGE: - if (isKnownViaSimpleReasoning(ICmpInst::ICMP_UGE, LHS, FoundLHS) && - isKnownViaSimpleReasoning(ICmpInst::ICMP_ULE, RHS, FoundRHS)) + if (isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_UGE, LHS, FoundLHS) && + isKnownViaNonRecursiveReasoning(ICmpInst::ICMP_ULE, RHS, FoundRHS)) return true; break; }