@@ -776,18 +776,17 @@ class ScalarEvolution {
776
776
// / Test whether entry to the loop is protected by a conditional between LHS
777
777
// / and RHS. This is used to help avoid max expressions in loop trip
778
778
// / counts, and to eliminate casts.
779
- bool isLoopEntryGuardedByCond (const Loop *L, ICmpInst::Predicate Pred,
779
+ bool isLoopEntryGuardedByCond (const Loop *L, CmpPredicate Pred,
780
780
const SCEV *LHS, const SCEV *RHS);
781
781
782
782
// / Test whether entry to the basic block is protected by a conditional
783
783
// / 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);
787
786
788
787
// / Test whether the backedge of the loop is protected by a conditional
789
788
// / 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,
791
790
const SCEV *LHS, const SCEV *RHS);
792
791
793
792
// / A version of getTripCountFromExitCount below which always picks an
@@ -1082,36 +1081,34 @@ class ScalarEvolution {
1082
1081
// / so we can assert on that.
1083
1082
// / e. Return true if isLoopEntryGuardedByCond(Pred, E(LHS), E(RHS)) &&
1084
1083
// / 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);
1087
1085
1088
1086
// / Test if the given expression is known to satisfy the condition described
1089
1087
// / 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);
1092
1089
1093
1090
// / Check whether the condition described by Pred, LHS, and RHS is true or
1094
1091
// / false. If we know it, return the evaluation of this condition. If neither
1095
1092
// / 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);
1098
1095
1099
1096
// / Test if the given expression is known to satisfy the condition described
1100
1097
// / 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);
1103
1100
1104
1101
// / Check whether the condition described by Pred, LHS, and RHS is true or
1105
1102
// / false in the given \p Context. If we know it, return the evaluation of
1106
1103
// / 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,
1109
1106
const Instruction *CtxI);
1110
1107
1111
1108
// / Test if the condition described by Pred, LHS, RHS is known to be true on
1112
1109
// / 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);
1115
1112
1116
1113
// / Information about the number of loop iterations for which a loop exit's
1117
1114
// / branch condition evaluates to the not-taken path. This is a temporary
@@ -1213,22 +1210,22 @@ class ScalarEvolution {
1213
1210
// / available at L's entry. Otherwise, return std::nullopt. The predicate
1214
1211
// / should be the loop's exit condition.
1215
1212
std::optional<LoopInvariantPredicate>
1216
- getLoopInvariantExitCondDuringFirstIterations (ICmpInst::Predicate Pred,
1213
+ getLoopInvariantExitCondDuringFirstIterations (CmpPredicate Pred,
1217
1214
const SCEV *LHS,
1218
1215
const SCEV *RHS, const Loop *L,
1219
1216
const Instruction *CtxI,
1220
1217
const SCEV *MaxIter);
1221
1218
1222
1219
std::optional<LoopInvariantPredicate>
1223
1220
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,
1225
1222
const Instruction *CtxI, const SCEV *MaxIter);
1226
1223
1227
1224
// / Simplify LHS and RHS in a comparison with predicate Pred. Return true
1228
1225
// / iff any changes were made. If the operands are provably equal or
1229
1226
// / unequal, LHS and RHS are set to the same value and Pred is set to either
1230
1227
// / ICMP_EQ or ICMP_NE.
1231
- bool SimplifyICmpOperands (ICmpInst::Predicate &Pred, const SCEV *&LHS,
1228
+ bool SimplifyICmpOperands (CmpPredicate &Pred, const SCEV *&LHS,
1232
1229
const SCEV *&RHS, unsigned Depth = 0 );
1233
1230
1234
1231
// / Return the "disposition" of the given SCEV with respect to the given
@@ -1904,7 +1901,7 @@ class ScalarEvolution {
1904
1901
// / as opposed to the ICmpInst itself. Note that the prior version can
1905
1902
// / return more precise results in some cases and is preferred when caller
1906
1903
// / has a materialized ICmp.
1907
- ExitLimit computeExitLimitFromICmp (const Loop *L, ICmpInst::Predicate Pred,
1904
+ ExitLimit computeExitLimitFromICmp (const Loop *L, CmpPredicate Pred,
1908
1905
const SCEV *LHS, const SCEV *RHS,
1909
1906
bool IsSubExpr,
1910
1907
bool AllowPredicates = false );
@@ -1977,34 +1974,33 @@ class ScalarEvolution {
1977
1974
// / whenever the given FoundCondValue value evaluates to true in given
1978
1975
// / Context. If Context is nullptr, then the found predicate is true
1979
1976
// / 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,
1981
1978
const Value *FoundCondValue, bool Inverse,
1982
1979
const Instruction *Context = nullptr );
1983
1980
1984
1981
// / Test whether the condition described by Pred, LHS, and RHS is true
1985
1982
// / whenever the given FoundCondValue value evaluates to true in given
1986
1983
// / Context. If Context is nullptr, then the found predicate is true
1987
1984
// / 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,
1991
1987
const SCEV *FoundLHS, const SCEV *FoundRHS,
1992
1988
const Instruction *CtxI);
1993
1989
1994
1990
// / Test whether the condition described by Pred, LHS, and RHS is true
1995
1991
// / whenever the condition described by FoundPred, FoundLHS, FoundRHS is
1996
1992
// / true in given Context. If Context is nullptr, then the found predicate is
1997
1993
// / 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,
2000
1996
const SCEV *FoundRHS,
2001
1997
const Instruction *Context = nullptr );
2002
1998
2003
1999
// / Test whether the condition described by Pred, LHS, and RHS is true
2004
2000
// / whenever the condition described by Pred, FoundLHS, and FoundRHS is
2005
2001
// / true in given Context. If Context is nullptr, then the found predicate is
2006
2002
// / true everywhere.
2007
- bool isImpliedCondOperands (ICmpInst::Predicate Pred, const SCEV *LHS,
2003
+ bool isImpliedCondOperands (CmpPredicate Pred, const SCEV *LHS,
2008
2004
const SCEV *RHS, const SCEV *FoundLHS,
2009
2005
const SCEV *FoundRHS,
2010
2006
const Instruction *Context = nullptr );
@@ -2013,36 +2009,34 @@ class ScalarEvolution {
2013
2009
// / whenever the condition described by Pred, FoundLHS, and FoundRHS is
2014
2010
// / true. Here LHS is an operation that includes FoundLHS as one of its
2015
2011
// / 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 );
2020
2015
2021
2016
// / Test whether the condition described by Pred, LHS, and RHS is true.
2022
2017
// / 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);
2025
2020
2026
2021
// / Test whether the condition described by Pred, LHS, and RHS is true
2027
2022
// / whenever the condition described by Pred, FoundLHS, and FoundRHS is
2028
2023
// / true.
2029
- bool isImpliedCondOperandsHelper (ICmpInst::Predicate Pred, const SCEV *LHS,
2024
+ bool isImpliedCondOperandsHelper (CmpPredicate Pred, const SCEV *LHS,
2030
2025
const SCEV *RHS, const SCEV *FoundLHS,
2031
2026
const SCEV *FoundRHS);
2032
2027
2033
2028
// / Test whether the condition described by Pred, LHS, and RHS is true
2034
2029
// / whenever the condition described by Pred, FoundLHS, and FoundRHS is
2035
2030
// / true. Utility function used by isImpliedCondOperands. Tries to get
2036
2031
// / 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,
2040
2034
const SCEV *FoundLHS,
2041
2035
const SCEV *FoundRHS);
2042
2036
2043
2037
// / Return true if the condition denoted by \p LHS \p Pred \p RHS is implied
2044
2038
// / 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,
2046
2040
const SCEV *LHS, const SCEV *RHS);
2047
2041
2048
2042
// / Test whether the condition described by Pred, LHS, and RHS is true
@@ -2051,9 +2045,8 @@ class ScalarEvolution {
2051
2045
// /
2052
2046
// / This routine tries to rule out certain kinds of integer overflow, and
2053
2047
// / 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,
2057
2050
const SCEV *FoundRHS);
2058
2051
2059
2052
// / Test whether the condition described by Pred, LHS, and RHS is true
@@ -2062,8 +2055,8 @@ class ScalarEvolution {
2062
2055
// /
2063
2056
// / This routine tries to weaken the known condition basing on fact that
2064
2057
// / 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,
2067
2060
const SCEV *FoundLHS,
2068
2061
const SCEV *FoundRHS,
2069
2062
const Instruction *CtxI);
@@ -2075,8 +2068,7 @@ class ScalarEvolution {
2075
2068
// / This routine tries to figure out predicate for Phis which are SCEVUnknown
2076
2069
// / if it is true for every possible incoming value from their respective
2077
2070
// / 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,
2080
2072
const SCEV *FoundLHS, const SCEV *FoundRHS,
2081
2073
unsigned Depth);
2082
2074
@@ -2085,7 +2077,7 @@ class ScalarEvolution {
2085
2077
// / true.
2086
2078
// /
2087
2079
// / This routine tries to reason about shifts.
2088
- bool isImpliedCondOperandsViaShift (ICmpInst::Predicate Pred, const SCEV *LHS,
2080
+ bool isImpliedCondOperandsViaShift (CmpPredicate Pred, const SCEV *LHS,
2089
2081
const SCEV *RHS, const SCEV *FoundLHS,
2090
2082
const SCEV *FoundRHS);
2091
2083
@@ -2097,20 +2089,20 @@ class ScalarEvolution {
2097
2089
2098
2090
// / Test if the given expression is known to satisfy the condition described
2099
2091
// / 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);
2102
2094
2103
2095
// / Try to prove the condition described by "LHS Pred RHS" by ruling out
2104
2096
// / integer overflow.
2105
2097
// /
2106
2098
// / For instance, this will return true for "A s< (A + C)<nsw>" if C is
2107
2099
// / positive.
2108
- bool isKnownPredicateViaNoOverflow (ICmpInst::Predicate Pred, const SCEV *LHS,
2100
+ bool isKnownPredicateViaNoOverflow (CmpPredicate Pred, const SCEV *LHS,
2109
2101
const SCEV *RHS);
2110
2102
2111
2103
// / Try to split Pred LHS RHS into logical conjunctions (and's) and try to
2112
2104
// / prove them individually.
2113
- bool isKnownPredicateViaSplitting (ICmpInst::Predicate Pred, const SCEV *LHS,
2105
+ bool isKnownPredicateViaSplitting (CmpPredicate Pred, const SCEV *LHS,
2114
2106
const SCEV *RHS);
2115
2107
2116
2108
// / Try to match the Expr as "(L + R)<Flags>".
0 commit comments