[llvm] [LV] Add initial legality checks for ee loops with stores (PR #145663)

Graham Hunter via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 5 03:16:27 PDT 2025


================
@@ -1207,8 +1209,42 @@ bool LoopVectorizationLegality::canVectorizeMemory() {
     });
   }
 
-  if (!LAI->canVectorizeMemory())
-    return canVectorizeIndirectUnsafeDependences();
+  if (LAI->canVectorizeMemory()) {
+    // FIXME: Remove or reduce this restriction. We're in a bit of an odd spot
+    //        since we're (potentially) doing the load out of its normal order
+    //        in the loop and that may throw off dependency checking.
+    //        A forward dependency should be fine, but a backwards dep may not
+    //        be even if LAA thinks it is due to performing the load for the
+    //        vector iteration i+1 in vector iteration i.
+    if (CriticalEELoad) {
----------------
huntergr-arm wrote:

The `LAI` variable has not been initialized when `isVectorizableEarlyExitLoop` is invoked, so we would have to reorder things a little in order to unify the code. If it's ok to initialize it there as well, I can do so and move the checks.

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


More information about the llvm-commits mailing list