[llvm] [VPlan] Introduce scalar loop header in plan, remove VPLiveOut. (PR #109975)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Oct 27 14:41:44 PDT 2024
================
@@ -8978,15 +8962,25 @@ static void addLiveOutsForFirstOrderRecurrences(
// lo = lcssa.phi [s1, scalar.body],
// [vector.recur.extract.for.phi, middle.block]
//
- // Extract the resume value and create a new VPLiveOut for it.
+ // Extract the resume value and update the VPIRInstrunction wrapping the
+ // phi in the scalar header block.
auto *Resume = MiddleBuilder.createNaryOp(VPInstruction::ExtractFromEnd,
{FOR->getBackedgeValue(), OneVPV},
{}, "vector.recur.extract");
auto *ResumePhiRecipe = ScalarPHBuilder.createNaryOp(
VPInstruction::ResumePhi, {Resume, FOR->getStartValue()}, {},
"scalar.recur.init");
auto *FORPhi = cast<PHINode>(FOR->getUnderlyingInstr());
- Plan.addLiveOut(FORPhi, ResumePhiRecipe);
+ VPIRInstruction *IRI = nullptr;
+ for (VPRecipeBase &R : *Plan.getScalarHeader()) {
----------------
ayalz wrote:
This linear scan of scalar header's recipes to find the one holding FORPhi (for every FORPhi) seems unnecessarily inefficient, even if the latter is expected among the initial phi's.
Worth holding a mapping from the PHINodes of the scalar header to the VPIRInstructions that wrap them, at least during initial VPlan construction? Or from them to their VPHeaderPhiRecipes, to support the opposite traversal/retrieval.
https://github.com/llvm/llvm-project/pull/109975
More information about the llvm-commits
mailing list