[llvm] [LV] Reject non-simple outer-loop memory accesses. (PR #226212)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 30 03:25:12 PDT 2026


================
@@ -623,6 +623,19 @@ bool LoopVectorizationLegality::canVectorizeOuterLoop() {
   bool DoExtraAnalysis = ORE->allowExtraAnalysis(DEBUG_TYPE);
 
   for (BasicBlock *BB : TheLoop->blocks()) {
+    // Don't try to vectorize outer loops with atomic or volatile accesses.
+    for (Instruction &I : *BB) {
+      if (!I.isAtomic() && !I.isVolatile())
+        continue;
+      reportVectorizationFailure(
+          "Unsupported volatile or atomic memory operation",
+          "instruction cannot be vectorized", "CantVectorizeInstruction", ORE,
+          TheLoop, &I);
+      if (!DoExtraAnalysis)
----------------
fhahn wrote:

good point, updated thanks!

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


More information about the llvm-commits mailing list