[llvm] 3281992 - [VPlan] Retire LVP::hasTailFolded (NFC). (#210598)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Jul 19 10:46:39 PDT 2026
Author: Florian Hahn
Date: 2026-07-19T18:46:34+01:00
New Revision: 32819927e0c02662a5c8aae252997748cdc94962
URL: https://github.com/llvm/llvm-project/commit/32819927e0c02662a5c8aae252997748cdc94962
DIFF: https://github.com/llvm/llvm-project/commit/32819927e0c02662a5c8aae252997748cdc94962.diff
LOG: [VPlan] Retire LVP::hasTailFolded (NFC). (#210598)
LVP::hasTailFolded incldued an assert that hasTailFOlded matches the
VPlan version. No divergences surfaced, so remove the assert as planned.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
index ed02d9475fc6f..89b16f9e27045 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h
@@ -969,10 +969,6 @@ class LoopVectorizationPlanner {
/// loop. Asserts that the VPlan decision matches the legacy cost model.
bool requiresScalarEpilogue(VPlan &Plan, ElementCount VF) const;
- /// Returns true if \p Plan folds the tail by masking. Asserts that the
- /// VPlan-based decision matches the legacy cost model.
- bool hasTailFolded(const VPlan &Plan) const;
-
/// Attach the runtime checks of \p RTChecks to \p Plan.
void attachRuntimeChecks(VPlan &Plan, GeneratedRTChecks &RTChecks,
bool HasBranchWeights) const;
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 1929f52ae7d95..4cd6a55f01a90 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -3617,7 +3617,8 @@ std::unique_ptr<VPlan> LoopVectorizationPlanner::selectBestEpiloguePlan(
}
if (Result.Width.isScalar() ||
- isMoreProfitable(NextVF, Result, MaxTripCount, !hasTailFolded(MainPlan),
+ isMoreProfitable(NextVF, Result, MaxTripCount,
+ !MainPlan.hasTailFolded(),
/*IsEpilogue*/ true)) {
Result = NextVF;
BestPlan = &CurrentPlan;
@@ -5669,7 +5670,7 @@ LoopVectorizationPlanner::precomputeCosts(VPlan &Plan, ElementCount VF,
// TODO: Remove this code after stepping away from the legacy cost model and
// adding code to simplify VPlans before calculating their costs.
auto TC = getSmallConstantTripCount(PSE.getSE(), OrigLoop);
- if (TC == VF && !hasTailFolded(Plan))
+ if (TC == VF && !Plan.hasTailFolded())
addFullyUnrolledInstructionsToIgnore(OrigLoop, Legal->getInductionVars(),
CostCtx.SkipCostComputation);
@@ -5966,7 +5967,7 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
RUN_VPLAN_PASS(VPlanTransforms::convertEVLExitCond, BestVPlan);
// Regions are dissolved after optimizing for VF and UF, which completely
// removes unneeded loop regions first.
- const bool HasTailFolded = hasTailFolded(BestVPlan);
+ const bool HasTailFolded = BestVPlan.hasTailFolded();
RUN_VPLAN_PASS(VPlanTransforms::dissolveLoopRegions, BestVPlan);
// Expand BranchOnTwoConds after dissolution, when latch has direct access to
// its successors.
@@ -7121,13 +7122,6 @@ bool LoopVectorizationPlanner::requiresScalarEpilogue(VPlan &Plan,
return Result;
}
-bool LoopVectorizationPlanner::hasTailFolded(const VPlan &Plan) const {
- bool Result = Plan.hasTailFolded();
- assert(CM.foldTailByMasking() == Result &&
- "CM.foldTailByMasking and the VPlan-based check must agree");
- return Result;
-}
-
void LoopVectorizationPlanner::addMinimumIterationCheck(
VPlan &Plan, ElementCount VF, unsigned UF,
ElementCount MinProfitableTripCount) const {
@@ -7137,7 +7131,7 @@ void LoopVectorizationPlanner::addMinimumIterationCheck(
: nullptr;
RUN_VPLAN_PASS(VPlanTransforms::addMinimumIterationCheck, Plan, VF, UF,
MinProfitableTripCount, requiresScalarEpilogue(Plan, VF),
- hasTailFolded(Plan), OrigLoop, BranchWeights,
+ Plan.hasTailFolded(), OrigLoop, BranchWeights,
OrigLoop->getLoopPredecessor()->getTerminator()->getDebugLoc(),
PSE, Plan.getEntry());
}
More information about the llvm-commits
mailing list