[llvm] [VPlan] Update scalar induction resume values in VPlan. (PR #110577)
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Nov 16 13:28:05 PST 2024
================
@@ -7808,6 +7813,27 @@ EpilogueVectorizerMainLoop::createEpilogueVectorizedLoopSkeleton(
// the second pass for the scalar loop. The induction resume values for the
// inductions in the epilogue loop are created before executing the plan for
// the epilogue loop.
+ VPBasicBlock *ScalarPHVPBB = Plan.getScalarPreheader();
+ VPBuilder ScalarPHBuilder(ScalarPHVPBB, ScalarPHVPBB->begin());
+ for (VPRecipeBase &R :
+ Plan.getVectorLoopRegion()->getEntryBasicBlock()->phis()) {
+ // Create induction resume values for both widened pointer and
+ // integer/fp inductions and update the start value of the induction
+ // recipes to use the resume value.
+ PHINode *IndPhi = nullptr;
+ const InductionDescriptor *ID;
+ if (auto *Ind = dyn_cast<VPWidenPointerInductionRecipe>(&R)) {
+ IndPhi = cast<PHINode>(Ind->getUnderlyingValue());
+ ID = &Ind->getInductionDescriptor();
+ } else if (auto *WidenInd = dyn_cast<VPWidenIntOrFpInductionRecipe>(&R)) {
+ IndPhi = WidenInd->getPHINode();
+ ID = &WidenInd->getInductionDescriptor();
+ } else
+ continue;
----------------
fhahn wrote:
Fixed, thanks!
https://github.com/llvm/llvm-project/pull/110577
More information about the llvm-commits
mailing list