[llvm] [DA] Set Distance to zero when Direction is EQ (PR #147966)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Thu Jul 10 07:17:26 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.");
+ }
----------------
Meinersbur wrote:
This will give unused variable warnings in non-assert builds. So only compile this in assert builds:
```suggestion
#ifndef NDEBUG
// 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.");
}
#endif
```
https://github.com/llvm/llvm-project/pull/147966
More information about the llvm-commits
mailing list