[llvm] [LV] Remove selectUserVF, remove use of legacy expectedCost (NFCI) (PR #191216)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Fri Apr 17 05:09:32 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()) {
----------------
fhahn wrote:
Updated the condition above to check if the last plan has UserVF, thanks
https://github.com/llvm/llvm-project/pull/191216
More information about the llvm-commits
mailing list