Skip to content

Commit d107c29

Browse files
authored
[VPlan] Strip unused CanonicalIVTy arg (NFC) (#153418)
1 parent 4b112d2 commit d107c29

File tree

3 files changed

+11
-16
lines changed

3 files changed

+11
-16
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7294,15 +7294,14 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
72947294
VPBasicBlock *VectorPH = cast<VPBasicBlock>(BestVPlan.getVectorPreheader());
72957295

72967296
VPlanTransforms::optimizeForVFAndUF(BestVPlan, BestVF, BestUF, PSE);
7297-
VPlanTransforms::simplifyRecipes(BestVPlan, *Legal->getWidestInductionType());
7297+
VPlanTransforms::simplifyRecipes(BestVPlan);
72987298
VPlanTransforms::removeBranchOnConst(BestVPlan);
72997299
VPlanTransforms::narrowInterleaveGroups(
73007300
BestVPlan, BestVF,
73017301
TTI.getRegisterBitWidth(TargetTransformInfo::RGK_FixedWidthVector));
73027302
VPlanTransforms::removeDeadRecipes(BestVPlan);
73037303

7304-
VPlanTransforms::convertToConcreteRecipes(BestVPlan,
7305-
*Legal->getWidestInductionType());
7304+
VPlanTransforms::convertToConcreteRecipes(BestVPlan);
73067305
// Regions are dissolved after optimizing for VF and UF, which completely
73077306
// removes unneeded loop regions first.
73087307
VPlanTransforms::dissolveLoopRegions(BestVPlan);

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1231,7 +1231,7 @@ static void simplifyRecipe(VPRecipeBase &R, VPTypeAnalysis &TypeInfo) {
12311231
}
12321232
}
12331233

1234-
void VPlanTransforms::simplifyRecipes(VPlan &Plan, Type &CanonicalIVTy) {
1234+
void VPlanTransforms::simplifyRecipes(VPlan &Plan) {
12351235
ReversePostOrderTraversal<VPBlockDeepTraversalWrapper<VPBlockBase *>> RPOT(
12361236
Plan.getEntry());
12371237
VPTypeAnalysis TypeInfo(Plan);
@@ -1498,7 +1498,6 @@ static bool simplifyBranchConditionForVFAndUF(VPlan &Plan, ElementCount BestVF,
14981498
// the region, otherwise replace the terminator controlling the latch with
14991499
// (BranchOnCond true).
15001500
auto *Header = cast<VPBasicBlock>(VectorRegion->getEntry());
1501-
auto *CanIVTy = Plan.getCanonicalIV()->getScalarType();
15021501
if (all_of(Header->phis(),
15031502
IsaPred<VPCanonicalIVPHIRecipe, VPEVLBasedIVPHIRecipe,
15041503
VPFirstOrderRecurrencePHIRecipe, VPPhi>)) {
@@ -1518,7 +1517,7 @@ static bool simplifyBranchConditionForVFAndUF(VPlan &Plan, ElementCount BestVF,
15181517

15191518
VPBlockUtils::connectBlocks(Preheader, Header);
15201519
VPBlockUtils::connectBlocks(ExitingVPBB, Exit);
1521-
VPlanTransforms::simplifyRecipes(Plan, *CanIVTy);
1520+
VPlanTransforms::simplifyRecipes(Plan);
15221521
} else {
15231522
// The vector region contains header phis for which we cannot remove the
15241523
// loop region yet.
@@ -1932,13 +1931,13 @@ void VPlanTransforms::optimize(VPlan &Plan) {
19321931
runPass(removeRedundantCanonicalIVs, Plan);
19331932
runPass(removeRedundantInductionCasts, Plan);
19341933

1935-
runPass(simplifyRecipes, Plan, *Plan.getCanonicalIV()->getScalarType());
1934+
runPass(simplifyRecipes, Plan);
19361935
runPass(simplifyBlends, Plan);
19371936
runPass(removeDeadRecipes, Plan);
19381937
runPass(narrowToSingleScalarRecipes, Plan);
19391938
runPass(legalizeAndOptimizeInductions, Plan);
19401939
runPass(removeRedundantExpandSCEVRecipes, Plan);
1941-
runPass(simplifyRecipes, Plan, *Plan.getCanonicalIV()->getScalarType());
1940+
runPass(simplifyRecipes, Plan);
19421941
runPass(removeBranchOnConst, Plan);
19431942
runPass(removeDeadRecipes, Plan);
19441943

@@ -2853,8 +2852,7 @@ void VPlanTransforms::dissolveLoopRegions(VPlan &Plan) {
28532852
R->dissolveToCFGLoop();
28542853
}
28552854

2856-
void VPlanTransforms::convertToConcreteRecipes(VPlan &Plan,
2857-
Type &CanonicalIVTy) {
2855+
void VPlanTransforms::convertToConcreteRecipes(VPlan &Plan) {
28582856
VPTypeAnalysis TypeInfo(Plan);
28592857
SmallVector<VPRecipeBase *> ToRemove;
28602858
for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(

llvm/lib/Transforms/Vectorize/VPlanTransforms.h

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -229,9 +229,8 @@ struct VPlanTransforms {
229229
/// EVLIVInc, TripCount).
230230
static void canonicalizeEVLLoops(VPlan &Plan);
231231

232-
/// Lower abstract recipes to concrete ones, that can be codegen'd. Use \p
233-
/// CanonicalIVTy as type for all un-typed live-ins in VPTypeAnalysis.
234-
static void convertToConcreteRecipes(VPlan &Plan, Type &CanonicalIVTy);
232+
/// Lower abstract recipes to concrete ones, that can be codegen'd.
233+
static void convertToConcreteRecipes(VPlan &Plan);
235234

236235
/// This function converts initial recipes to the abstract recipes and clamps
237236
/// \p Range based on cost model for following optimizations and cost
@@ -240,9 +239,8 @@ struct VPlanTransforms {
240239
static void convertToAbstractRecipes(VPlan &Plan, VPCostContext &Ctx,
241240
VFRange &Range);
242241

243-
/// Perform instcombine-like simplifications on recipes in \p Plan. Use \p
244-
/// CanonicalIVTy as type for all un-typed live-ins in VPTypeAnalysis.
245-
static void simplifyRecipes(VPlan &Plan, Type &CanonicalIVTy);
242+
/// Perform instcombine-like simplifications on recipes in \p Plan.
243+
static void simplifyRecipes(VPlan &Plan);
246244

247245
/// Remove BranchOnCond recipes with true or false conditions together with
248246
/// removing dead edges to their successors.

0 commit comments

Comments
 (0)