[llvm] [LAA] Pass maximum stride to isSafeDependenceDistance. (PR #90036)
Michael Kruse via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 26 13:02:53 PDT 2024
================
@@ -2046,14 +2046,15 @@ MemoryDepChecker::Dependence::DepType MemoryDepChecker::isDependent(
ScalarEvolution &SE = *PSE.getSE();
auto &DL = InnermostLoop->getHeader()->getModule()->getDataLayout();
+ uint64_t MaxStride = std::max(StrideA, StrideB);
- // If the distance between the acecsses is larger than their absolute stride
- // multiplied by the backedge taken count, the accesses are independet, i.e.
- // they are far enough appart that accesses won't access the same location
- // across all loop ierations.
- if (HasSameSize && CommonStride &&
+ // If the distance between the acecsses is larger than their maximum absolute
+ // stride multiplied by the backedge taken count, the accesses are independet,
+ // i.e. they are far enough appart that accesses won't access the same
+ // location across all loop ierations.
+ if (HasSameSize &&
----------------
Meinersbur wrote:
I think StrideA/StrideB are set to 0 if the stride could not be computed (and then indistinguishable from no stride; `getPtrStride` actually returns an `std::optional` but it is lost somewhere). I think we must ensure that neither StrideA nor StrideB are zero.
Or even better: Keep passing on the `std::optional` from `getPtrStride`.
Or even better: Use `StrideA` or `StrideB` depending on whether `Dist` is negative or positive.
https://github.com/llvm/llvm-project/pull/90036
More information about the llvm-commits
mailing list