[llvm] [LV] Remove selectUserVF, remove use of legacy expectedCost (NFCI) (PR #191216)

David Sherwood via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 17 05:20:13 PDT 2026


================
@@ -6653,20 +6617,26 @@ void LoopVectorizationPlanner::plan(ElementCount UserVF, unsigned UserIC) {
       // Collect the instructions (and their associated costs) that will be more
       // profitable to scalarize.
       CM.collectInLoopReductions();
-      if (CM.selectUserVectorizationFactor(UserVF)) {
-        LLVM_DEBUG(dbgs() << "LV: Using user VF " << UserVF << ".\n");
-        ElementCount EpilogueUserVF =
-            ElementCount::getFixed(EpilogueVectorizationForceVF);
-        if (EpilogueUserVF.isVector() &&
-            ElementCount::isKnownLT(EpilogueUserVF, UserVF) &&
-            CM.selectUserVectorizationFactor(EpilogueUserVF)) {
-          // Build a separate plan for the forced epilogue VF.
-          buildVPlansWithVPRecipes(EpilogueUserVF, EpilogueUserVF);
+      CM.collectNonVectorizedAndSetWideningDecisions(UserVF);
+      ElementCount EpilogueUserVF =
+          ElementCount::getFixed(EpilogueVectorizationForceVF);
+      if (EpilogueUserVF.isVector() &&
+          ElementCount::isKnownLT(EpilogueUserVF, UserVF)) {
+        CM.collectNonVectorizedAndSetWideningDecisions(EpilogueUserVF);
+        buildVPlansWithVPRecipes(EpilogueUserVF, EpilogueUserVF);
+      }
+      buildVPlansWithVPRecipes(UserVF, UserVF);
----------------
david-arm wrote:

Thanks. Yeah you're probably right we can't hit this today - I was just thinking it's the sort of bug that can easily creep in if buildVPlansWithVPRecipes changes more over time!

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


More information about the llvm-commits mailing list