[llvm] f3d93f5 - [LV] Don't access loop after executePlan in native path (NFC). (#191277)

via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 9 12:49:58 PDT 2026


Author: Florian Hahn
Date: 2026-04-09T19:49:53Z
New Revision: f3d93f56e0492ea9dbd1e0f1591796b48a99b9e1

URL: https://github.com/llvm/llvm-project/commit/f3d93f56e0492ea9dbd1e0f1591796b48a99b9e1
DIFF: https://github.com/llvm/llvm-project/commit/f3d93f56e0492ea9dbd1e0f1591796b48a99b9e1.diff

LOG: [LV] Don't access loop after executePlan in native path (NFC). (#191277)

Bring native path in line with inner loop path: the loop may become
invalid once we are able to remove the scalar loop in the native path as
well. Match inner loop behavior by reporting vectorization before
executePlan, and using F instead of L->getHeader()->getParent().

Added: 
    

Modified: 
    llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 3aa35a9de7598..018895ab55bd8 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -8661,20 +8661,20 @@ static bool processLoopInVPlanNativePath(
     GeneratedRTChecks Checks(PSE, DT, LI, TTI, CM.CostKind);
     InnerLoopVectorizer LB(L, PSE, LI, DT, TTI, AC, VF.Width, /*UF=*/1, &CM,
                            Checks, BestPlan);
-    LLVM_DEBUG(dbgs() << "Vectorizing outer loop in \""
-                      << L->getHeader()->getParent()->getName() << "\"\n");
+    LLVM_DEBUG(dbgs() << "Vectorizing outer loop in \"" << F->getName()
+                      << "\"\n");
     LVP.addMinimumIterationCheck(BestPlan, VF.Width, /*UF=*/1,
                                  VF.MinProfitableTripCount);
     bool HasBranchWeights =
         hasBranchWeightMD(*L->getLoopLatch()->getTerminator());
     LVP.attachRuntimeChecks(BestPlan, Checks, HasBranchWeights);
 
+    reportVectorization(ORE, L, VF, 1);
+
     LVP.executePlan(VF.Width, /*UF=*/1, BestPlan, LB, DT);
   }
 
-  reportVectorization(ORE, L, VF, 1);
-
-  assert(!verifyFunction(*L->getHeader()->getParent(), &dbgs()));
+  assert(!verifyFunction(*F, &dbgs()));
   return true;
 }
 


        


More information about the llvm-commits mailing list