[llvm] 65136a3 - SCEV: migrate LoopInvariantPredicate to CmpPredicate (NFC) (#125204)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jan 31 08:50:51 PST 2025
Author: Ramkumar Ramachandra
Date: 2025-01-31T16:50:48Z
New Revision: 65136a35309670c24bd0b8c98561fa4f7b503a70
URL: https://github.com/llvm/llvm-project/commit/65136a35309670c24bd0b8c98561fa4f7b503a70
DIFF: https://github.com/llvm/llvm-project/commit/65136a35309670c24bd0b8c98561fa4f7b503a70.diff
LOG: SCEV: migrate LoopInvariantPredicate to CmpPredicate (NFC) (#125204)
Follow up on 60dc450 (SCEV: migrate to CmpPredicate (NFC)) to migrate
the missed ScalarEvolution::LoopInvariantPredicate to CmpPredicate.
Added:
Modified:
llvm/include/llvm/Analysis/ScalarEvolution.h
llvm/lib/Analysis/ScalarEvolution.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/ScalarEvolution.h b/llvm/include/llvm/Analysis/ScalarEvolution.h
index a011f16b4d95c0..f729b07076d293 100644
--- a/llvm/include/llvm/Analysis/ScalarEvolution.h
+++ b/llvm/include/llvm/Analysis/ScalarEvolution.h
@@ -1188,21 +1188,19 @@ class ScalarEvolution {
ICmpInst::Predicate Pred);
struct LoopInvariantPredicate {
- ICmpInst::Predicate Pred;
+ CmpPredicate Pred;
const SCEV *LHS;
const SCEV *RHS;
- LoopInvariantPredicate(ICmpInst::Predicate Pred, const SCEV *LHS,
- const SCEV *RHS)
+ LoopInvariantPredicate(CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS)
: Pred(Pred), LHS(LHS), RHS(RHS) {}
};
/// If the result of the predicate LHS `Pred` RHS is loop invariant with
/// respect to L, return a LoopInvariantPredicate with LHS and RHS being
/// invariants, available at L's entry. Otherwise, return std::nullopt.
std::optional<LoopInvariantPredicate>
- getLoopInvariantPredicate(ICmpInst::Predicate Pred, const SCEV *LHS,
- const SCEV *RHS, const Loop *L,
- const Instruction *CtxI = nullptr);
+ getLoopInvariantPredicate(CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS,
+ const Loop *L, const Instruction *CtxI = nullptr);
/// If the result of the predicate LHS `Pred` RHS is loop invariant with
/// respect to L at given Context during at least first MaxIter iterations,
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp
index 2ce40877b523e1..0d7bbe3f996408 100644
--- a/llvm/lib/Analysis/ScalarEvolution.cpp
+++ b/llvm/lib/Analysis/ScalarEvolution.cpp
@@ -11165,9 +11165,8 @@ ScalarEvolution::getMonotonicPredicateTypeImpl(const SCEVAddRecExpr *LHS,
}
std::optional<ScalarEvolution::LoopInvariantPredicate>
-ScalarEvolution::getLoopInvariantPredicate(ICmpInst::Predicate Pred,
- const SCEV *LHS, const SCEV *RHS,
- const Loop *L,
+ScalarEvolution::getLoopInvariantPredicate(CmpPredicate Pred, const SCEV *LHS,
+ const SCEV *RHS, const Loop *L,
const Instruction *CtxI) {
// If there is a loop-invariant, force it into the RHS, otherwise bail out.
if (!isLoopInvariant(RHS, L)) {
@@ -11175,7 +11174,7 @@ ScalarEvolution::getLoopInvariantPredicate(ICmpInst::Predicate Pred,
return std::nullopt;
std::swap(LHS, RHS);
- Pred = ICmpInst::getSwappedPredicate(Pred);
+ Pred = ICmpInst::getSwappedCmpPredicate(Pred);
}
const SCEVAddRecExpr *ArLHS = dyn_cast<SCEVAddRecExpr>(LHS);
@@ -11203,7 +11202,7 @@ ScalarEvolution::getLoopInvariantPredicate(ICmpInst::Predicate Pred,
// A similar reasoning applies for a monotonically decreasing predicate, by
// replacing true with false and false with true in the above two bullets.
bool Increasing = *MonotonicType == ScalarEvolution::MonotonicallyIncreasing;
- auto P = Increasing ? Pred : ICmpInst::getInversePredicate(Pred);
+ auto P = Increasing ? Pred : ICmpInst::getInverseCmpPredicate(Pred);
if (isLoopBackedgeGuardedByCond(L, P, LHS, RHS))
return ScalarEvolution::LoopInvariantPredicate(Pred, ArLHS->getStart(),
More information about the llvm-commits
mailing list