[llvm] [LV] codegen for tail-folded epilogue loop (PR #208764)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 3 03:32:56 PDT 2026


================
@@ -5543,18 +5543,22 @@ void LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC) {
       // Collect the instructions (and their associated costs) that will be more
       // profitable to scalarize.
       CM.collectNonVectorizedAndSetWideningDecisions(UserVF);
+      // Build the main-loop VPlan firstly because if epilogue tail-folding is
+      // enabled, it will be built later, so we keep the epilogue vplans at the
+      // end.
+      buildVPlans(*VPlan1, UserVF, UserVF, CM);
----------------
david-arm wrote:

It might be worth pulling this change out into a separate NFC PR in preparation for this one? It seems like a sensible enough change by itself, i.e. have the main loop first, followed by the epilogue, which matches the IR structure too.

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


More information about the llvm-commits mailing list