[llvm] [VPlan] Introduce scalar loop header in plan, remove VPLiveOut. (PR #109975)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 29 12:27:29 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()) {
+ IRI = cast<VPIRInstruction>(&R);
+ if (&IRI->getInstruction() == FORPhi) {
+ IRI->addOperand(ResumePhiRecipe);
+ break;
+ }
+ IRI = nullptr;
+ }
+ assert(IRI && "IRI needs to be set, implying it had its operand updated");
// Now update VPIRInstructions modeling LCSSA phis in the exit block.
// Extract the penultimate value of the recurrence and use it as operand for
----------------
fhahn wrote:
Yes I thought the same thing, will adjust separately.
https://github.com/llvm/llvm-project/pull/109975
More information about the llvm-commits
mailing list