@@ -776,18 +776,17 @@ class ScalarEvolution {
776776 // / Test whether entry to the loop is protected by a conditional between LHS
777777 // / and RHS. This is used to help avoid max expressions in loop trip
778778 // / counts, and to eliminate casts.
779- bool isLoopEntryGuardedByCond (const Loop *L, ICmpInst::Predicate Pred,
779+ bool isLoopEntryGuardedByCond (const Loop *L, CmpPredicate Pred,
780780 const SCEV *LHS, const SCEV *RHS);
781781
782782 // / Test whether entry to the basic block is protected by a conditional
783783 // / between LHS and RHS.
784- bool isBasicBlockEntryGuardedByCond (const BasicBlock *BB,
785- ICmpInst::Predicate Pred, const SCEV *LHS,
786- const SCEV *RHS);
784+ bool isBasicBlockEntryGuardedByCond (const BasicBlock *BB, CmpPredicate Pred,
785+ const SCEV *LHS, const SCEV *RHS);
787786
788787 // / Test whether the backedge of the loop is protected by a conditional
789788 // / between LHS and RHS. This is used to eliminate casts.
790- bool isLoopBackedgeGuardedByCond (const Loop *L, ICmpInst::Predicate Pred,
789+ bool isLoopBackedgeGuardedByCond (const Loop *L, CmpPredicate Pred,
791790 const SCEV *LHS, const SCEV *RHS);
792791
793792 // / A version of getTripCountFromExitCount below which always picks an
@@ -1082,36 +1081,34 @@ class ScalarEvolution {
10821081 // / so we can assert on that.
10831082 // / e. Return true if isLoopEntryGuardedByCond(Pred, E(LHS), E(RHS)) &&
10841083 // / isLoopBackedgeGuardedByCond(Pred, B(LHS), B(RHS))
1085- bool isKnownViaInduction (ICmpInst::Predicate Pred, const SCEV *LHS,
1086- const SCEV *RHS);
1084+ bool isKnownViaInduction (CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS);
10871085
10881086 // / Test if the given expression is known to satisfy the condition described
10891087 // / by Pred, LHS, and RHS.
1090- bool isKnownPredicate (ICmpInst::Predicate Pred, const SCEV *LHS,
1091- const SCEV *RHS);
1088+ bool isKnownPredicate (CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS);
10921089
10931090 // / Check whether the condition described by Pred, LHS, and RHS is true or
10941091 // / false. If we know it, return the evaluation of this condition. If neither
10951092 // / is proved, return std::nullopt.
1096- std::optional<bool > evaluatePredicate (ICmpInst::Predicate Pred,
1097- const SCEV *LHS, const SCEV * RHS);
1093+ std::optional<bool > evaluatePredicate (CmpPredicate Pred, const SCEV *LHS ,
1094+ const SCEV *RHS);
10981095
10991096 // / Test if the given expression is known to satisfy the condition described
11001097 // / by Pred, LHS, and RHS in the given Context.
1101- bool isKnownPredicateAt (ICmpInst::Predicate Pred, const SCEV *LHS,
1102- const SCEV *RHS, const Instruction *CtxI);
1098+ bool isKnownPredicateAt (CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS ,
1099+ const Instruction *CtxI);
11031100
11041101 // / Check whether the condition described by Pred, LHS, and RHS is true or
11051102 // / false in the given \p Context. If we know it, return the evaluation of
11061103 // / this condition. If neither is proved, return std::nullopt.
1107- std::optional<bool > evaluatePredicateAt (ICmpInst::Predicate Pred,
1108- const SCEV *LHS, const SCEV * RHS,
1104+ std::optional<bool > evaluatePredicateAt (CmpPredicate Pred, const SCEV *LHS ,
1105+ const SCEV *RHS,
11091106 const Instruction *CtxI);
11101107
11111108 // / Test if the condition described by Pred, LHS, RHS is known to be true on
11121109 // / every iteration of the loop of the recurrency LHS.
1113- bool isKnownOnEveryIteration (ICmpInst::Predicate Pred,
1114- const SCEVAddRecExpr *LHS, const SCEV *RHS);
1110+ bool isKnownOnEveryIteration (CmpPredicate Pred, const SCEVAddRecExpr *LHS ,
1111+ const SCEV *RHS);
11151112
11161113 // / Information about the number of loop iterations for which a loop exit's
11171114 // / branch condition evaluates to the not-taken path. This is a temporary
@@ -1213,22 +1210,22 @@ class ScalarEvolution {
12131210 // / available at L's entry. Otherwise, return std::nullopt. The predicate
12141211 // / should be the loop's exit condition.
12151212 std::optional<LoopInvariantPredicate>
1216- getLoopInvariantExitCondDuringFirstIterations (ICmpInst::Predicate Pred,
1213+ getLoopInvariantExitCondDuringFirstIterations (CmpPredicate Pred,
12171214 const SCEV *LHS,
12181215 const SCEV *RHS, const Loop *L,
12191216 const Instruction *CtxI,
12201217 const SCEV *MaxIter);
12211218
12221219 std::optional<LoopInvariantPredicate>
12231220 getLoopInvariantExitCondDuringFirstIterationsImpl (
1224- ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS, const Loop *L,
1221+ CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS, const Loop *L,
12251222 const Instruction *CtxI, const SCEV *MaxIter);
12261223
12271224 // / Simplify LHS and RHS in a comparison with predicate Pred. Return true
12281225 // / iff any changes were made. If the operands are provably equal or
12291226 // / unequal, LHS and RHS are set to the same value and Pred is set to either
12301227 // / ICMP_EQ or ICMP_NE.
1231- bool SimplifyICmpOperands (ICmpInst::Predicate &Pred, const SCEV *&LHS,
1228+ bool SimplifyICmpOperands (CmpPredicate &Pred, const SCEV *&LHS,
12321229 const SCEV *&RHS, unsigned Depth = 0 );
12331230
12341231 // / Return the "disposition" of the given SCEV with respect to the given
@@ -1904,7 +1901,7 @@ class ScalarEvolution {
19041901 // / as opposed to the ICmpInst itself. Note that the prior version can
19051902 // / return more precise results in some cases and is preferred when caller
19061903 // / has a materialized ICmp.
1907- ExitLimit computeExitLimitFromICmp (const Loop *L, ICmpInst::Predicate Pred,
1904+ ExitLimit computeExitLimitFromICmp (const Loop *L, CmpPredicate Pred,
19081905 const SCEV *LHS, const SCEV *RHS,
19091906 bool IsSubExpr,
19101907 bool AllowPredicates = false );
@@ -1977,34 +1974,33 @@ class ScalarEvolution {
19771974 // / whenever the given FoundCondValue value evaluates to true in given
19781975 // / Context. If Context is nullptr, then the found predicate is true
19791976 // / everywhere. LHS and FoundLHS may have different type width.
1980- bool isImpliedCond (ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS,
1977+ bool isImpliedCond (CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS,
19811978 const Value *FoundCondValue, bool Inverse,
19821979 const Instruction *Context = nullptr );
19831980
19841981 // / Test whether the condition described by Pred, LHS, and RHS is true
19851982 // / whenever the given FoundCondValue value evaluates to true in given
19861983 // / Context. If Context is nullptr, then the found predicate is true
19871984 // / everywhere. LHS and FoundLHS must have same type width.
1988- bool isImpliedCondBalancedTypes (ICmpInst::Predicate Pred, const SCEV *LHS,
1989- const SCEV *RHS,
1990- ICmpInst::Predicate FoundPred,
1985+ bool isImpliedCondBalancedTypes (CmpPredicate Pred, const SCEV *LHS,
1986+ const SCEV *RHS, CmpPredicate FoundPred,
19911987 const SCEV *FoundLHS, const SCEV *FoundRHS,
19921988 const Instruction *CtxI);
19931989
19941990 // / Test whether the condition described by Pred, LHS, and RHS is true
19951991 // / whenever the condition described by FoundPred, FoundLHS, FoundRHS is
19961992 // / true in given Context. If Context is nullptr, then the found predicate is
19971993 // / true everywhere.
1998- bool isImpliedCond (ICmpInst::Predicate Pred, const SCEV *LHS, const SCEV *RHS,
1999- ICmpInst::Predicate FoundPred, const SCEV *FoundLHS,
1994+ bool isImpliedCond (CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS,
1995+ CmpPredicate FoundPred, const SCEV *FoundLHS,
20001996 const SCEV *FoundRHS,
20011997 const Instruction *Context = nullptr );
20021998
20031999 // / Test whether the condition described by Pred, LHS, and RHS is true
20042000 // / whenever the condition described by Pred, FoundLHS, and FoundRHS is
20052001 // / true in given Context. If Context is nullptr, then the found predicate is
20062002 // / true everywhere.
2007- bool isImpliedCondOperands (ICmpInst::Predicate Pred, const SCEV *LHS,
2003+ bool isImpliedCondOperands (CmpPredicate Pred, const SCEV *LHS,
20082004 const SCEV *RHS, const SCEV *FoundLHS,
20092005 const SCEV *FoundRHS,
20102006 const Instruction *Context = nullptr );
@@ -2013,36 +2009,34 @@ class ScalarEvolution {
20132009 // / whenever the condition described by Pred, FoundLHS, and FoundRHS is
20142010 // / true. Here LHS is an operation that includes FoundLHS as one of its
20152011 // / arguments.
2016- bool isImpliedViaOperations (ICmpInst::Predicate Pred,
2017- const SCEV *LHS, const SCEV *RHS,
2018- const SCEV *FoundLHS, const SCEV *FoundRHS,
2019- unsigned Depth = 0 );
2012+ bool isImpliedViaOperations (CmpPredicate Pred, const SCEV *LHS,
2013+ const SCEV *RHS, const SCEV *FoundLHS,
2014+ const SCEV *FoundRHS, unsigned Depth = 0 );
20202015
20212016 // / Test whether the condition described by Pred, LHS, and RHS is true.
20222017 // / Use only simple non-recursive types of checks, such as range analysis etc.
2023- bool isKnownViaNonRecursiveReasoning (ICmpInst::Predicate Pred,
2024- const SCEV *LHS, const SCEV * RHS);
2018+ bool isKnownViaNonRecursiveReasoning (CmpPredicate Pred, const SCEV *LHS ,
2019+ const SCEV *RHS);
20252020
20262021 // / Test whether the condition described by Pred, LHS, and RHS is true
20272022 // / whenever the condition described by Pred, FoundLHS, and FoundRHS is
20282023 // / true.
2029- bool isImpliedCondOperandsHelper (ICmpInst::Predicate Pred, const SCEV *LHS,
2024+ bool isImpliedCondOperandsHelper (CmpPredicate Pred, const SCEV *LHS,
20302025 const SCEV *RHS, const SCEV *FoundLHS,
20312026 const SCEV *FoundRHS);
20322027
20332028 // / Test whether the condition described by Pred, LHS, and RHS is true
20342029 // / whenever the condition described by Pred, FoundLHS, and FoundRHS is
20352030 // / true. Utility function used by isImpliedCondOperands. Tries to get
20362031 // / cases like "X `sgt` 0 => X - 1 `sgt` -1".
2037- bool isImpliedCondOperandsViaRanges (ICmpInst::Predicate Pred, const SCEV *LHS,
2038- const SCEV *RHS,
2039- ICmpInst::Predicate FoundPred,
2032+ bool isImpliedCondOperandsViaRanges (CmpPredicate Pred, const SCEV *LHS,
2033+ const SCEV *RHS, CmpPredicate FoundPred,
20402034 const SCEV *FoundLHS,
20412035 const SCEV *FoundRHS);
20422036
20432037 // / Return true if the condition denoted by \p LHS \p Pred \p RHS is implied
20442038 // / by a call to @llvm.experimental.guard in \p BB.
2045- bool isImpliedViaGuard (const BasicBlock *BB, ICmpInst::Predicate Pred,
2039+ bool isImpliedViaGuard (const BasicBlock *BB, CmpPredicate Pred,
20462040 const SCEV *LHS, const SCEV *RHS);
20472041
20482042 // / Test whether the condition described by Pred, LHS, and RHS is true
@@ -2051,9 +2045,8 @@ class ScalarEvolution {
20512045 // /
20522046 // / This routine tries to rule out certain kinds of integer overflow, and
20532047 // / then tries to reason about arithmetic properties of the predicates.
2054- bool isImpliedCondOperandsViaNoOverflow (ICmpInst::Predicate Pred,
2055- const SCEV *LHS, const SCEV *RHS,
2056- const SCEV *FoundLHS,
2048+ bool isImpliedCondOperandsViaNoOverflow (CmpPredicate Pred, const SCEV *LHS,
2049+ const SCEV *RHS, const SCEV *FoundLHS,
20572050 const SCEV *FoundRHS);
20582051
20592052 // / Test whether the condition described by Pred, LHS, and RHS is true
@@ -2062,8 +2055,8 @@ class ScalarEvolution {
20622055 // /
20632056 // / This routine tries to weaken the known condition basing on fact that
20642057 // / FoundLHS is an AddRec.
2065- bool isImpliedCondOperandsViaAddRecStart (ICmpInst::Predicate Pred,
2066- const SCEV *LHS, const SCEV * RHS,
2058+ bool isImpliedCondOperandsViaAddRecStart (CmpPredicate Pred, const SCEV *LHS ,
2059+ const SCEV *RHS,
20672060 const SCEV *FoundLHS,
20682061 const SCEV *FoundRHS,
20692062 const Instruction *CtxI);
@@ -2075,8 +2068,7 @@ class ScalarEvolution {
20752068 // / This routine tries to figure out predicate for Phis which are SCEVUnknown
20762069 // / if it is true for every possible incoming value from their respective
20772070 // / basic blocks.
2078- bool isImpliedViaMerge (ICmpInst::Predicate Pred,
2079- const SCEV *LHS, const SCEV *RHS,
2071+ bool isImpliedViaMerge (CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS,
20802072 const SCEV *FoundLHS, const SCEV *FoundRHS,
20812073 unsigned Depth);
20822074
@@ -2085,7 +2077,7 @@ class ScalarEvolution {
20852077 // / true.
20862078 // /
20872079 // / This routine tries to reason about shifts.
2088- bool isImpliedCondOperandsViaShift (ICmpInst::Predicate Pred, const SCEV *LHS,
2080+ bool isImpliedCondOperandsViaShift (CmpPredicate Pred, const SCEV *LHS,
20892081 const SCEV *RHS, const SCEV *FoundLHS,
20902082 const SCEV *FoundRHS);
20912083
@@ -2097,20 +2089,20 @@ class ScalarEvolution {
20972089
20982090 // / Test if the given expression is known to satisfy the condition described
20992091 // / by Pred and the known constant ranges of LHS and RHS.
2100- bool isKnownPredicateViaConstantRanges (ICmpInst::Predicate Pred,
2101- const SCEV *LHS, const SCEV * RHS);
2092+ bool isKnownPredicateViaConstantRanges (CmpPredicate Pred, const SCEV *LHS ,
2093+ const SCEV *RHS);
21022094
21032095 // / Try to prove the condition described by "LHS Pred RHS" by ruling out
21042096 // / integer overflow.
21052097 // /
21062098 // / For instance, this will return true for "A s< (A + C)<nsw>" if C is
21072099 // / positive.
2108- bool isKnownPredicateViaNoOverflow (ICmpInst::Predicate Pred, const SCEV *LHS,
2100+ bool isKnownPredicateViaNoOverflow (CmpPredicate Pred, const SCEV *LHS,
21092101 const SCEV *RHS);
21102102
21112103 // / Try to split Pred LHS RHS into logical conjunctions (and's) and try to
21122104 // / prove them individually.
2113- bool isKnownPredicateViaSplitting (ICmpInst::Predicate Pred, const SCEV *LHS,
2105+ bool isKnownPredicateViaSplitting (CmpPredicate Pred, const SCEV *LHS,
21142106 const SCEV *RHS);
21152107
21162108 // / Try to match the Expr as "(L + R)<Flags>".
0 commit comments