[llvm] [DA] Move constraint propagation under flag disabled by default (PR #160924)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 26 09:59:27 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-llvm-analysis

Author: Sebastian Pop (sebpop)

<details>
<summary>Changes</summary>

Add -da-enable-constraint-propagation flag (disabled by default).

---
Full diff: https://github.com/llvm/llvm-project/pull/160924.diff


3 Files Affected:

- (modified) llvm/lib/Analysis/DependenceAnalysis.cpp (+8-2) 
- (modified) llvm/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll (+1-1) 
- (modified) llvm/test/Analysis/DependenceAnalysis/Separability.ll (+1-1) 


``````````diff
diff --git a/llvm/lib/Analysis/DependenceAnalysis.cpp b/llvm/lib/Analysis/DependenceAnalysis.cpp
index da86a8d2cc9c0..af1884048752b 100644
--- a/llvm/lib/Analysis/DependenceAnalysis.cpp
+++ b/llvm/lib/Analysis/DependenceAnalysis.cpp
@@ -121,6 +121,10 @@ static cl::opt<unsigned> MIVMaxLevelThreshold(
     cl::desc("Maximum depth allowed for the recursive algorithm used to "
              "explore MIV direction vectors."));
 
+static cl::opt<bool> EnableConstraintPropagation(
+    "da-enable-constraint-propagation", cl::init(false), cl::Hidden,
+    cl::desc("Enable constraint propagation in dependence analysis."));
+
 //===----------------------------------------------------------------------===//
 // basics
 
@@ -3918,7 +3922,8 @@ DependenceInfo::depends(Instruction *Src, Instruction *Dst,
           for (unsigned SJ : Mivs.set_bits()) {
             // SJ is an MIV subscript that's part of the current coupled group
             LLVM_DEBUG(dbgs() << "\tSJ = " << SJ << "\n");
-            if (propagate(Pair[SJ].Src, Pair[SJ].Dst, Pair[SJ].Loops,
+            if (EnableConstraintPropagation &&
+                propagate(Pair[SJ].Src, Pair[SJ].Dst, Pair[SJ].Loops,
                           Constraints, Result.Consistent)) {
               LLVM_DEBUG(dbgs() << "\t    Changed\n");
               ++DeltaPropagations;
@@ -4233,7 +4238,8 @@ const SCEV *DependenceInfo::getSplitIteration(const Dependence &Dep,
       // propagate, possibly creating new SIVs and ZIVs
       for (unsigned SJ : Mivs.set_bits()) {
         // SJ is an MIV subscript that's part of the current coupled group
-        if (!propagate(Pair[SJ].Src, Pair[SJ].Dst, Pair[SJ].Loops, Constraints,
+        if (!EnableConstraintPropagation ||
+            !propagate(Pair[SJ].Src, Pair[SJ].Dst, Pair[SJ].Loops, Constraints,
                        Result.Consistent))
           continue;
         Pair[SJ].Classification = classifyPair(
diff --git a/llvm/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll b/llvm/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll
index e5d5d21e365a1..d03b797dc394f 100644
--- a/llvm/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll
+++ b/llvm/test/Analysis/DependenceAnalysis/NonCanonicalizedSubscript.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
-; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa -da-enable-constraint-propagation 2>&1 \
 ; RUN: | FileCheck %s
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
diff --git a/llvm/test/Analysis/DependenceAnalysis/Separability.ll b/llvm/test/Analysis/DependenceAnalysis/Separability.ll
index 2ed9cca4d1fc0..3556d877e1dc0 100644
--- a/llvm/test/Analysis/DependenceAnalysis/Separability.ll
+++ b/llvm/test/Analysis/DependenceAnalysis/Separability.ll
@@ -1,5 +1,5 @@
 ; NOTE: Assertions have been autogenerated by utils/update_analyze_test_checks.py UTC_ARGS: --version 5
-; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa 2>&1 \
+; RUN: opt < %s -disable-output "-passes=print<da>" -aa-pipeline=basic-aa -da-enable-constraint-propagation 2>&1 \
 ; RUN: | FileCheck %s
 
 target datalayout = "e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"

``````````

</details>


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


More information about the llvm-commits mailing list