Skip to content

Commit a2a0ef5

Browse files
committed
[VPlan] Retrieve LatchVPBB from region in adjustRecipesForRed (NFC)
The HeaderVPBB is retrieved in a similar fashion already. This is in preparation for splitting up the very large tryToBuildVPlanWithVPRecipes into several distinct functions, as suggested multiple times, including in #94760
1 parent 2a36ef5 commit a2a0ef5

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ class LoopVectorizationPlanner {
428428
// converted to reductions, with one operand being vector and the other being
429429
// the scalar reduction chain. For other reductions, a select is introduced
430430
// between the phi and live-out recipes when folding the tail.
431-
void adjustRecipesForReductions(VPBasicBlock *LatchVPBB, VPlanPtr &Plan,
431+
void adjustRecipesForReductions(VPlanPtr &Plan,
432432
VPRecipeBuilder &RecipeBuilder,
433433
ElementCount MinVF);
434434

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8696,7 +8696,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) {
86968696
// ---------------------------------------------------------------------------
86978697

86988698
// Adjust the recipes for any inloop reductions.
8699-
adjustRecipesForReductions(LatchVPBB, Plan, RecipeBuilder, Range.Start);
8699+
adjustRecipesForReductions(Plan, RecipeBuilder, Range.Start);
87008700

87018701
// Interleave memory: for each Interleave Group we marked earlier as relevant
87028702
// for this VPlan, replace the Recipes widening its memory instructions with a
@@ -8838,8 +8838,7 @@ VPlanPtr LoopVectorizationPlanner::buildVPlan(VFRange &Range) {
88388838
// with a boolean reduction phi node to check if the condition is true in any
88398839
// iteration. The final value is selected by the final ComputeReductionResult.
88408840
void LoopVectorizationPlanner::adjustRecipesForReductions(
8841-
VPBasicBlock *LatchVPBB, VPlanPtr &Plan, VPRecipeBuilder &RecipeBuilder,
8842-
ElementCount MinVF) {
8841+
VPlanPtr &Plan, VPRecipeBuilder &RecipeBuilder, ElementCount MinVF) {
88438842
VPRegionBlock *VectorLoopRegion = Plan->getVectorLoopRegion();
88448843
VPBasicBlock *Header = VectorLoopRegion->getEntryBasicBlock();
88458844
// Gather all VPReductionPHIRecipe and sort them so that Intermediate stores
@@ -9003,6 +9002,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions(
90039002
PreviousLink = RedRecipe;
90049003
}
90059004
}
9005+
VPBasicBlock *LatchVPBB = VectorLoopRegion->getExitingBasicBlock();
90069006
Builder.setInsertPoint(&*LatchVPBB->begin());
90079007
VPBasicBlock *MiddleVPBB =
90089008
cast<VPBasicBlock>(VectorLoopRegion->getSingleSuccessor());

0 commit comments

Comments
 (0)