[llvm] [DA] Set Distance to zero when Direction is EQ (PR #147966)

Madhur Amilkanthwar via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 10 07:47:43 PDT 2025


================
@@ -187,6 +187,18 @@ static void dumpExampleDependence(raw_ostream &OS, DependenceInfo *DA,
           OS << "  da analyze - ";
           if (auto D = DA->depends(&*SrcI, &*DstI,
                                    /*UnderRuntimeAssumptions=*/true)) {
+
+            // Verify that the distance begin zero is equivalent to the
+            // direction being EQ.
+            for (unsigned Level = 1; Level <= D->getLevels(); Level++) {
+              const SCEV *Distance = D->getDistance(Level);
+              bool IsDistanceZero = Distance && Distance->isZero();
+              bool IsDirectionEQ =
+                  D->getDirection(Level) == Dependence::DVEntry::EQ;
+              assert(IsDistanceZero == IsDirectionEQ &&
+                     "Inconsistent distance and direction.");
+            }
----------------
madhur13490 wrote:

I would add `#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` to this.

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


More information about the llvm-commits mailing list