[llvm] [VPlan] Update getBestPlan to return VF, use also for epilogue vec. (PR #98821)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 24 12:26:54 PDT 2024


================
@@ -10089,18 +10092,10 @@ bool LoopVectorizePass::processLoop(Loop *L) {
         if (!MainILV.areSafetyChecksAdded())
           DisableRuntimeUnroll = true;
       } else {
-        VPlan &BestPlan = LVP.getBestPlan();
-        assert(size(BestPlan.vectorFactors()) == 1 &&
-               "Plan should have a single VF");
-        ElementCount Width = *BestPlan.vectorFactors().begin();
-        LLVM_DEBUG(dbgs() << "VF picked by VPlan cost model: " << Width
-                          << "\n");
-        assert(VF.Width == Width &&
-               "VPlan cost model and legacy cost model disagreed");
-        InnerLoopVectorizer LB(L, PSE, LI, DT, TLI, TTI, AC, ORE, Width,
+        InnerLoopVectorizer LB(L, PSE, LI, DT, TLI, TTI, AC, ORE, BestVF,
                                VF.MinProfitableTripCount, IC, &LVL, &CM, BFI,
                                PSI, Checks);
-        LVP.executePlan(Width, IC, BestPlan, LB, DT, false);
+        LVP.executePlan(BestVF, IC, BestPlan, LB, DT, false);
----------------
ayalz wrote:

```suggestion
        VPlan &BestPlan = LVP.getBestPlanFor(BestVF);
        LVP.executePlan(BestVF, IC, BestPlan, LB, DT, false);
```

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


More information about the llvm-commits mailing list