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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 18 03:26:39 PDT 2025


================
@@ -1207,8 +1208,16 @@ bool LoopVectorizationLegality::canVectorizeMemory() {
     });
   }
 
-  if (!LAI->canVectorizeMemory())
-    return canVectorizeIndirectUnsafeDependences();
+  if (!LAI->canVectorizeMemory()) {
+    if (!hasUncountedExitWithSideEffects())
+      return canVectorizeIndirectUnsafeDependences();
+    reportVectorizationFailure(
+        "Cannot vectorize unsafe dependencies in early exit loop with "
+        "side effects.",
+        "Unable to vectorize memory in an early exit loop with side effects",
+        "CantVectorizeUnsafeDependencyForEELoopWithSideEffects", ORE, TheLoop);
+    return false;
----------------
fhahn wrote:

```suggestion
    if (hasUncountedExitWithSideEffects()) {
    reportVectorizationFailure(
        "Cannot vectorize unsafe dependencies in early exit loop with "
        "side effects.",
        "Unable to vectorize memory in an early exit loop with side effects",
        "CantVectorizeUnsafeDependencyForEELoopWithSideEffects", ORE, TheLoop);
    return false;
    }
    
     return canVectorizeIndirectUnsafeDependences();
```

might be clearer to keep the check together with the EE specific message

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


More information about the llvm-commits mailing list