Skip to content

Commit f2fcd9c

Browse files
committed
[VPlan] Rename getBestPlanFor -> getPlanFor (NFC).
As suggested in #103033, more accurately rename to getPlanFor , as it simplify returns the VPlan for VF, relying on the fact that there is a single VPlan for each VF at the moment.
1 parent abf69a1 commit f2fcd9c

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,9 @@ class LoopVectorizationPlanner {
362362
/// VF and its cost.
363363
VectorizationFactor planInVPlanNativePath(ElementCount UserVF);
364364

365-
/// Return the best VPlan for \p VF.
366-
VPlan &getBestPlanFor(ElementCount VF) const;
365+
/// Return the VPlan for \p VF. At the moment, there is always a single VPlan
366+
/// for each VF.
367+
VPlan &getPlanFor(ElementCount VF) const;
367368

368369
/// Compute and return the most profitable vectorization factor. Also collect
369370
/// all profitable VFs in ProfitableVFs.

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9487,7 +9487,7 @@ static bool processLoopInVPlanNativePath(
94879487
if (VPlanBuildStressTest || VectorizationFactor::Disabled() == VF)
94889488
return false;
94899489

9490-
VPlan &BestPlan = LVP.getBestPlanFor(VF.Width);
9490+
VPlan &BestPlan = LVP.getPlanFor(VF.Width);
94919491

94929492
{
94939493
bool AddBranchWeights =
@@ -9967,7 +9967,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
99679967
ElementCount BestVF = LVP.computeBestVF();
99689968
assert(BestVF.isScalar() &&
99699969
"VPlan cost model and legacy cost model disagreed");
9970-
VPlan &BestPlan = LVP.getBestPlanFor(BestVF);
9970+
VPlan &BestPlan = LVP.getPlanFor(BestVF);
99719971
LVP.executePlan(BestVF, IC, BestPlan, Unroller, DT, false);
99729972

99739973
ORE->emit([&]() {
@@ -9983,7 +9983,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
99839983
LLVM_DEBUG(dbgs() << "VF picked by VPlan cost model: " << BestVF << "\n");
99849984
assert(VF.Width == BestVF &&
99859985
"VPlan cost model and legacy cost model disagreed");
9986-
VPlan &BestPlan = LVP.getBestPlanFor(BestVF);
9986+
VPlan &BestPlan = LVP.getPlanFor(BestVF);
99879987
// Consider vectorizing the epilogue too if it's profitable.
99889988
VectorizationFactor EpilogueVF =
99899989
LVP.selectEpilogueVectorizationFactor(BestVF, IC);
@@ -10009,7 +10009,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
1000910009
ORE, EPI, &LVL, &CM, BFI, PSI,
1001010010
Checks);
1001110011

10012-
VPlan &BestEpiPlan = LVP.getBestPlanFor(EPI.EpilogueVF);
10012+
VPlan &BestEpiPlan = LVP.getPlanFor(EPI.EpilogueVF);
1001310013
VPRegionBlock *VectorLoop = BestEpiPlan.getVectorLoopRegion();
1001410014
VPBasicBlock *Header = VectorLoop->getEntryBasicBlock();
1001510015
Header->setName("vec.epilog.vector.body");

llvm/lib/Transforms/Vectorize/VPlan.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1680,11 +1680,11 @@ void LoopVectorizationPlanner::buildVPlans(ElementCount MinVF,
16801680
}
16811681
}
16821682

1683-
VPlan &LoopVectorizationPlanner::getBestPlanFor(ElementCount VF) const {
1683+
VPlan &LoopVectorizationPlanner::getPlanFor(ElementCount VF) const {
16841684
assert(count_if(VPlans,
16851685
[VF](const VPlanPtr &Plan) { return Plan->hasVF(VF); }) ==
16861686
1 &&
1687-
"Best VF has not a single VPlan.");
1687+
"Multiple VPlans for VF.");
16881688

16891689
for (const VPlanPtr &Plan : VPlans) {
16901690
if (Plan->hasVF(VF))

0 commit comments

Comments
 (0)