[llvm] f2fcd9c - [VPlan] Rename getBestPlanFor -> getPlanFor (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 19 05:05:36 PDT 2024
Author: Florian Hahn
Date: 2024-08-19T13:05:19+01:00
New Revision: f2fcd9cb97f76f34196233fc5c9170fb0905d844
URL: https://github.com/llvm/llvm-project/commit/f2fcd9cb97f76f34196233fc5c9170fb0905d844
DIFF: https://github.com/llvm/llvm-project/commit/f2fcd9cb97f76f34196233fc5c9170fb0905d844.diff
LOG: [VPlan] Rename getBestPlanFor -> getPlanFor (NFC).
As suggested in https://github.com/llvm/llvm-project/pull/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.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
llvm/lib/Transforms/Vectorize/VPlan.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
index cd2680b0d43ac..7d242082172c6 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
@@ -362,8 +362,9 @@ class LoopVectorizationPlanner {
/// VF and its cost.
VectorizationFactor planInVPlanNativePath(ElementCount UserVF);
- /// Return the best VPlan for \p VF.
- VPlan &getBestPlanFor(ElementCount VF) const;
+ /// Return the VPlan for \p VF. At the moment, there is always a single VPlan
+ /// for each VF.
+ VPlan &getPlanFor(ElementCount VF) const;
/// Compute and return the most profitable vectorization factor. Also collect
/// all profitable VFs in ProfitableVFs.
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 0bae9ad1844ec..d097ae116a0d2 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -9487,7 +9487,7 @@ static bool processLoopInVPlanNativePath(
if (VPlanBuildStressTest || VectorizationFactor::Disabled() == VF)
return false;
- VPlan &BestPlan = LVP.getBestPlanFor(VF.Width);
+ VPlan &BestPlan = LVP.getPlanFor(VF.Width);
{
bool AddBranchWeights =
@@ -9967,7 +9967,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
ElementCount BestVF = LVP.computeBestVF();
assert(BestVF.isScalar() &&
"VPlan cost model and legacy cost model disagreed");
- VPlan &BestPlan = LVP.getBestPlanFor(BestVF);
+ VPlan &BestPlan = LVP.getPlanFor(BestVF);
LVP.executePlan(BestVF, IC, BestPlan, Unroller, DT, false);
ORE->emit([&]() {
@@ -9983,7 +9983,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
LLVM_DEBUG(dbgs() << "VF picked by VPlan cost model: " << BestVF << "\n");
assert(VF.Width == BestVF &&
"VPlan cost model and legacy cost model disagreed");
- VPlan &BestPlan = LVP.getBestPlanFor(BestVF);
+ VPlan &BestPlan = LVP.getPlanFor(BestVF);
// Consider vectorizing the epilogue too if it's profitable.
VectorizationFactor EpilogueVF =
LVP.selectEpilogueVectorizationFactor(BestVF, IC);
@@ -10009,7 +10009,7 @@ bool LoopVectorizePass::processLoop(Loop *L) {
ORE, EPI, &LVL, &CM, BFI, PSI,
Checks);
- VPlan &BestEpiPlan = LVP.getBestPlanFor(EPI.EpilogueVF);
+ VPlan &BestEpiPlan = LVP.getPlanFor(EPI.EpilogueVF);
VPRegionBlock *VectorLoop = BestEpiPlan.getVectorLoopRegion();
VPBasicBlock *Header = VectorLoop->getEntryBasicBlock();
Header->setName("vec.epilog.vector.body");
diff --git a/llvm/lib/Transforms/Vectorize/VPlan.cpp b/llvm/lib/Transforms/Vectorize/VPlan.cpp
index fe5edcedff54a..15acfc00251e2 100644
--- a/llvm/lib/Transforms/Vectorize/VPlan.cpp
+++ b/llvm/lib/Transforms/Vectorize/VPlan.cpp
@@ -1680,11 +1680,11 @@ void LoopVectorizationPlanner::buildVPlans(ElementCount MinVF,
}
}
-VPlan &LoopVectorizationPlanner::getBestPlanFor(ElementCount VF) const {
+VPlan &LoopVectorizationPlanner::getPlanFor(ElementCount VF) const {
assert(count_if(VPlans,
[VF](const VPlanPtr &Plan) { return Plan->hasVF(VF); }) ==
1 &&
- "Best VF has not a single VPlan.");
+ "Multiple VPlans for VF.");
for (const VPlanPtr &Plan : VPlans) {
if (Plan->hasVF(VF))
More information about the llvm-commits
mailing list