[llvm] [DA] Simplify runtime predicate collection and extend to all dependence tests (PR #157523)

Ryotaro Kasuga via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 10 01:24:01 PDT 2025


================
@@ -355,7 +356,33 @@ class DependenceInfo {
   ScalarEvolution *SE;
   LoopInfo *LI;
   Function *F;
-  SmallVector<const SCEVPredicate *, 4> Assumptions;
+
+  /// Runtime assumptions collected during dependence analysis.
+  ///
+  /// The dependence analysis employs a cascade of tests from simple to complex:
+  /// ZIV -> SIV (Strong/Weak-Crossing/Weak-Zero) -> RDIV -> MIV -> Banerjee.
+  /// Each test attempts to characterize the dependence with increasing
+  /// precision.
+  ///
+  /// Assumption Management Strategy:
+  /// - Each test may require runtime assumptions (e.g., "coefficient != 0")
+  ///   to provide precise analysis.
+  /// - If UnderRuntimeAssumptions=true: tests can add assumptions and continue.
+  /// - If UnderRuntimeAssumptions=false: tests that need assumptions fail
+  ///   gracefully, allowing more complex tests to attempt analysis.
+  /// - Only assumptions from successful tests contribute to the final result.
+  /// - SCEVUnionPredicate automatically deduplicates redundant assumptions.
+  ///
+  /// This design ensures:
+  /// 1. Simpler tests get priority (better performance).
+  /// 2. Complex tests serve as fallbacks when simple tests fail.
+  /// 3. No unnecessary runtime checks from failed test attempts.
+  /// 4. Maintains the intended cascade behavior of the dependence analysis.
+  SCEVUnionPredicate Assumptions;
+
+  /// Indicates whether runtime assumptions are collected during the analysis.
+  /// When false, dependence tests that would require runtime assumptions fail.
+  bool UnderRuntimeAssumptions;
----------------
kasuga-fj wrote:

Seems unnecessary.

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


More information about the llvm-commits mailing list