[llvm] [VPlan] Only use selectVectorizationFactor for cross-check (NFCI). (PR #103033)

via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 20 09:02:25 PDT 2024


================
@@ -10018,11 +10012,8 @@ bool LoopVectorizePass::processLoop(Loop *L) {
       InnerLoopUnroller Unroller(L, PSE, LI, DT, TLI, TTI, AC, ORE, IC, &LVL,
                                  &CM, BFI, PSI, Checks);
 
-      ElementCount BestVF = LVP.getBestVF();
-      assert(BestVF.isScalar() &&
-             "VPlan cost model and legacy cost model disagreed");
-      VPlan &BestPlan = LVP.getBestPlanFor(BestVF);
-      LVP.executePlan(BestVF, IC, BestPlan, Unroller, DT, false);
+      VPlan &BestPlan = LVP.getBestPlanFor(VF.Width);
+      LVP.executePlan(VF.Width, IC, BestPlan, Unroller, DT, false);
----------------
ayalz wrote:

`selectInterleaveCount` does use .Cost "to interleave small loops in order to reduce the loop overhead", but is already set to obtain the cost directly if the one provided is zero - uncomputed (later treating zero cost as "free" ... loop is effectively empty).

`areRuntimeChecksProfitable` also uses ScalarCost, noting that "The scalar cost should only be 0 when vectorizing with a user specified VF/IC ...", sigh. Anyhow, agree that bailing-out due to unprofitable runtime checks belongs in planning and getting the best VF, rather than later.

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


More information about the llvm-commits mailing list