[llvm] [VPlan] First step towards VPlan cost modeling (LegacyCM in CostCtx) (PR #92555)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 3 03:51:05 PDT 2024


================
@@ -10249,8 +10360,15 @@ bool LoopVectorizePass::processLoop(Loop *L) {
                                VF.MinProfitableTripCount, IC, &LVL, &CM, BFI,
                                PSI, Checks);
 
-        VPlan &BestPlan = LVP.getBestPlanFor(VF.Width);
-        LVP.executePlan(VF.Width, IC, BestPlan, LB, DT, false);
+        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");
----------------
fhahn wrote:

Added a comment to both the call site and header for selectVectorizationFactor; with this patch, it is only used to cross-check the VPlan-based one, but the VPlan-based one will pick the plan to execute via getBestPlan in the main code vector code path (epilogue vectorization code path is not updated yet)

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


More information about the llvm-commits mailing list