Skip to content

Commit

Permalink
[VPlan] Rename getBestVF -> computeBestVF (NFC).
Browse files Browse the repository at this point in the history
As suggested in #103033, more
accurately rename to computeBestVF, as it now does not simply return the
best VF, but directly computes it.
  • Loading branch information
fhahn committed Aug 19, 2024
1 parent 065d2d9 commit 740f055
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,9 +365,9 @@ class LoopVectorizationPlanner {
/// Return the best VPlan for \p VF.
VPlan &getBestPlanFor(ElementCount VF) const;

/// Return the most profitable vectorization factor. Also collect all
/// profitable VFs in ProfitableVFs.
ElementCount getBestVF();
/// Compute and return the most profitable vectorization factor. Also collect
/// all profitable VFs in ProfitableVFs.
ElementCount computeBestVF();

/// Generate the IR code for the vectorized loop captured in VPlan \p BestPlan
/// according to the best selected \p VF and \p UF.
Expand Down
6 changes: 3 additions & 3 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7250,7 +7250,7 @@ InstructionCost LoopVectorizationPlanner::cost(VPlan &Plan,
return Cost;
}

ElementCount LoopVectorizationPlanner::getBestVF() {
ElementCount LoopVectorizationPlanner::computeBestVF() {
// If there is a single VPlan with a single VF, return it directly.
VPlan &FirstPlan = *VPlans[0];
if (VPlans.size() == 1 && size(FirstPlan.vectorFactors()) == 1)
Expand Down Expand Up @@ -9959,7 +9959,7 @@ 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();
ElementCount BestVF = LVP.computeBestVF();
assert(BestVF.isScalar() &&
"VPlan cost model and legacy cost model disagreed");
VPlan &BestPlan = LVP.getBestPlanFor(BestVF);
Expand All @@ -9974,7 +9974,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
} else {
// If we decided that it is *legal* to vectorize the loop, then do it.

ElementCount BestVF = LVP.getBestVF();
ElementCount BestVF = LVP.computeBestVF();
LLVM_DEBUG(dbgs() << "VF picked by VPlan cost model: " << BestVF << "\n");
assert(VF.Width == BestVF &&
"VPlan cost model and legacy cost model disagreed");
Expand Down

0 comments on commit 740f055

Please sign in to comment.