diff options
| author | Florian Hahn <flo@fhahn.com> | 2025-11-22 20:45:41 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-22 20:45:41 +0000 |
| commit | 080ca902c6aaf1a1bf48df04a65ed163825b2006 (patch) | |
| tree | 5c1790b0d636ab21a839fceb6e45d9ee617c6a9c /llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | |
| parent | e83cc896e7c2378914a391f942c188d454b517d2 (diff) | |
[VPlan] Create resume phis in scalar preheader early. (NFC) (#166099)
Create phi recipes for scalar resume value up front in addInitialSkeleton during initial construction. This will allow moving the remaining code dealing with resume values to VPlan transforms/construction.
PR: https://github.com/llvm/llvm-project/pull/166099
Diffstat (limited to 'llvm/lib/Transforms/Vectorize/LoopVectorize.cpp')
| -rw-r--r-- | llvm/lib/Transforms/Vectorize/LoopVectorize.cpp | 17 |
1 files changed, 3 insertions, 14 deletions
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index 5b8725178521..277e43a38018 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -8532,7 +8532,7 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlanWithVPRecipes( // failures. VPlanTransforms::addExitUsersForFirstOrderRecurrences(*Plan, Range); DenseMap<VPValue *, VPValue *> IVEndValues; - VPlanTransforms::addScalarResumePhis(*Plan, RecipeBuilder, IVEndValues); + VPlanTransforms::updateScalarResumePhis(*Plan, IVEndValues); // --------------------------------------------------------------------------- // Transform initial VPlan: Apply previously taken decisions, in order, to @@ -8630,23 +8630,12 @@ VPlanPtr LoopVectorizationPlanner::tryToBuildVPlan(VFRange &Range) { *TLI)) return nullptr; - // Collect mapping of IR header phis to header phi recipes, to be used in - // addScalarResumePhis. - DenseMap<VPBasicBlock *, VPValue *> BlockMaskCache; - VPRecipeBuilder RecipeBuilder(*Plan, OrigLoop, TLI, &TTI, Legal, CM, PSE, - Builder, BlockMaskCache); - for (auto &R : Plan->getVectorLoopRegion()->getEntryBasicBlock()->phis()) { - if (isa<VPCanonicalIVPHIRecipe>(&R)) - continue; - auto *HeaderR = cast<VPHeaderPHIRecipe>(&R); - RecipeBuilder.setRecipe(HeaderR->getUnderlyingInstr(), HeaderR); - } - DenseMap<VPValue *, VPValue *> IVEndValues; // TODO: IVEndValues are not used yet in the native path, to optimize exit // values. // TODO: We can't call runPass on the transform yet, due to verifier // failures. - VPlanTransforms::addScalarResumePhis(*Plan, RecipeBuilder, IVEndValues); + DenseMap<VPValue *, VPValue *> IVEndValues; + VPlanTransforms::updateScalarResumePhis(*Plan, IVEndValues); assert(verifyVPlanIsValid(*Plan) && "VPlan is invalid"); return Plan; |
