[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 08:28:31 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:
It is possible to build a non-assert build with `-DLLVM_ENABLE_DUMP=ON` in which case one would get the same unused-variable warning.
`#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)` is for `void dump()` functions that are normally excluded from non-assert builds, but can be re-added using `LLVM_ENABLE_DUMP`. No `.dump()` function being declared or used here.
https://github.com/llvm/llvm-project/pull/147966
More information about the llvm-commits
mailing list