[llvm] [LV] Remove selectUserVF, remove use of legacy expectedCost (NFCI) (PR #191216)
David Sherwood via llvm-commits
llvm-commits at lists.llvm.org
Tue Apr 14 08:51:48 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);
+ if (!VPlans.empty()) {
+ // For scalar VF, skip VPlan cost check as VPlan cost is designed for
+ // vector VFs only.
+ if (UserVF.isScalar() ||
+ cost(*VPlans.back(), UserVF, /*RU=*/nullptr).isValid()) {
----------------
david-arm wrote:
This presumably is assuming that the last vplan in the list corresponds to the UserVF, but as mentioned above it may actually be the epilogue user vf.
https://github.com/llvm/llvm-project/pull/191216
More information about the llvm-commits
mailing list