[llvm] [LV] Return best plan directly from selectBestEpiloguePlan (NFC). (PR #190608)

via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 06:20:14 PDT 2026


================
@@ -9620,45 +9630,45 @@ bool LoopVectorizePass::processLoop(Loop *L) {
 
   VPlan &BestPlan = *BestPlanPtr;
   // Consider vectorizing the epilogue too if it's profitable.
-  VectorizationFactor EpilogueVF =
-      LVP.selectEpilogueVectorizationFactor(BestPlan, VF.Width, IC);
+  std::unique_ptr<VPlan> EpiPlan =
+      LVP.selectBestEpiloguePlan(BestPlan, VF.Width, IC);
   bool HasBranchWeights =
       hasBranchWeightMD(*L->getLoopLatch()->getTerminator());
-  if (EpilogueVF.Width.isVector()) {
-    std::unique_ptr<VPlan> BestMainPlan(BestPlan.duplicate());
+  if (EpiPlan) {
+    VPlan &BestEpiPlan = *EpiPlan;
----------------
ayalz wrote:

```suggestion
  if (BestEpiPlanPtr) {
    VPlan &BestEpiPlan = *BestEpiPlanPtr;
```
both plans are the best, one is a pointer the other a reference.

Arguably `BestPlan` is renamed `BestMainPlan` only now, when an EpiPlan is also being considered.

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


More information about the llvm-commits mailing list