[llvm] [LAA] Support backward dependences with non-constant distance. (PR #91525)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Thu May 9 05:44:00 PDT 2024


================
@@ -2179,11 +2180,23 @@ MemoryDepChecker::Dependence::DepType MemoryDepChecker::isDependent(
   // If MinNumIter is 4 (Say if a user forces the vectorization factor to be 4),
   // the minimum distance needed is 28, which is greater than distance. It is
   // not safe to do vectorization.
+
+  // We know that Dist is positive, but it may not be constant. Use the signed
+  // minimum for computations below, as this ensures we compute the closest
+  // possible dependence distance.
+  int64_t MinDistance = SE.getSignedRangeMin(Dist).getSExtValue();
----------------
fhahn wrote:

Adjusted to first get MinDistance and then check that value, thanks!

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


More information about the llvm-commits mailing list