[llvm] [DA] Check monotonicity for subscripts (PR #154527)

Michael Kruse via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 22 03:28:11 PDT 2025


================
@@ -921,6 +921,14 @@ class DependenceInfo {
   /// checkDstSubscript to avoid duplicate code
   bool checkSubscript(const SCEV *Expr, const Loop *LoopNest,
                       SmallBitVector &Loops, bool IsSrc);
+
+  /// Test whether \p Expr is monotonic or not. Return true if we can prove it
+  /// is monotonic. The term "monotonic" means that all AddRec Exprs in \p Expr
+  /// doesn't wrap in signed sense. When it is monotonic, the minimum and
+  /// maximum values of \p Expr are stored in \p Min and \p Max, respectively.
+  bool isMonotonicSCEV(const SCEV *Expr, const SCEV *&Min, const SCEV *&Max,
----------------
Meinersbur wrote:

Document parameters?

Consider adding "signed" to the name. Currently DA assumes everything is a signed SCEV, but maybe we change that one day.

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


More information about the llvm-commits mailing list