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

Eli Friedman via llvm-commits llvm-commits at lists.llvm.org
Wed May 8 14:08:03 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();
----------------
efriedma-quic wrote:

isKnownPositive() is a wrapper around getSignedRangeMin(), so that's probably fine; maybe refactor to make it more explicit.

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


More information about the llvm-commits mailing list