[llvm-branch-commits] [llvm] [SCEV] Prove monotonic predicates from loop entry in isKnownViaInduction (PR #231697)

Max Kazantsev via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Oct 20 08:06:31 PDT 2026


================
@@ -2461,6 +2461,25 @@ class ScalarEvolution {
   bool isKnownOnEveryIteration(CmpPredicate Pred, const SCEV *LHS,
                                const SCEV *RHS, const Loop *L);
 
+  /// "AR Pred RHS", with AR a recurrence of a loop and RHS invariant in it,
+  /// and how the predicate changes as the loop iterates.
+  struct MonotonicPredicate {
+    CmpPredicate Pred;
+    const SCEVAddRecExpr *AR;
+    const SCEV *RHS;
+    MonotonicPredicateType Type;
+    /// Whether the operands were swapped to put the recurrence on the left.
----------------
xortator wrote:

This doesn't make sense. The comment above says RHS is invariant. Now it says that it might be an addrec.

https://github.com/llvm/llvm-project/pull/231697


More information about the llvm-branch-commits mailing list