From a2a0ef567cd92e3df03f10cab8a9ebc62aff3be9 Mon Sep 17 00:00:00 2001 From: Florian Hahn Date: Tue, 9 Jul 2024 10:48:43 +0100 Subject: [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 https://github.com/llvm/llvm-project/pull/94760 --- llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h | 2 +- llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h index de8dc86..44db0ea3 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h +++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationPlanner.h @@ -428,7 +428,7 @@ private: // converted to reductions, with one operand being vector and the other being // the scalar reduction chain. For other reductions, a select is introduced // between the phi and live-out recipes when folding the tail. - void adjustRecipesForReductions(VPBasicBlock *LatchVPBB, VPlanPtr &Plan, + void adjustRecipesForReductions(VPlanPtr &Plan, VPRecipeBuilder &RecipeBuilder, ElementCount MinVF); diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 208246f..0ca4607 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -8696,7 +8696,7 @@ LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes(VFRange &Range) { // --------------------------------------------------------------------------- // Adjust the recipes for any inloop reductions. - adjustRecipesForReductions(LatchVPBB, Plan, RecipeBuilder, Range.Start); + adjustRecipesForReductions(Plan, RecipeBuilder, Range.Start); // Interleave memory: for each Interleave Group we marked earlier as relevant // for this VPlan, replace the Recipes widening its memory instructions with a @@ -8838,8 +8838,7 @@ VPlanPtr LoopVectorizationPlanner::buildVPlan(VFRange &Range) { // with a boolean reduction phi node to check if the condition is true in any // iteration. The final value is selected by the final ComputeReductionResult. void LoopVectorizationPlanner::adjustRecipesForReductions( - VPBasicBlock *LatchVPBB, VPlanPtr &Plan, VPRecipeBuilder &RecipeBuilder, - ElementCount MinVF) { + VPlanPtr &Plan, VPRecipeBuilder &RecipeBuilder, ElementCount MinVF) { VPRegionBlock *VectorLoopRegion = Plan->getVectorLoopRegion(); VPBasicBlock *Header = VectorLoopRegion->getEntryBasicBlock(); // Gather all VPReductionPHIRecipe and sort them so that Intermediate stores @@ -9003,6 +9002,7 @@ void LoopVectorizationPlanner::adjustRecipesForReductions( PreviousLink = RedRecipe; } } + VPBasicBlock *LatchVPBB = VectorLoopRegion->getExitingBasicBlock(); Builder.setInsertPoint(&*LatchVPBB->begin()); VPBasicBlock *MiddleVPBB = cast(VectorLoopRegion->getSingleSuccessor()); -- cgit v1.1