[llvm] [VPlan] Update scalar induction resume values in VPlan. (PR #110577)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 4 09:02:10 PST 2024
================
@@ -7724,13 +7739,22 @@ DenseMap<const SCEV *, Value *> LoopVectorizationPlanner::executePlan(
BestVPlan.execute(&State);
- // 2.5 Collect reduction resume values.
auto *ExitVPBB = BestVPlan.getMiddleBlock();
- if (VectorizingEpilogue)
+ // 2.5 When vectorizing the epilogue, fix reduction and induction resume
+ // values from the additional bypass block.
+ if (VectorizingEpilogue) {
+ BasicBlock *BypassBlock = ILV.getInductionAdditionalBypassBlock();
for (VPRecipeBase &R : *ExitVPBB) {
fixReductionScalarResumeWhenVectorizingEpilog(
- &R, State, State.CFG.VPBB2IRBB[ExitVPBB]);
+ &R, State, State.CFG.VPBB2IRBB[ExitVPBB], BypassBlock);
+ }
+ BasicBlock *PH = OrigLoop->getLoopPreheader();
+ for (const auto &[IVPhi, _] : Legal->getInductionVars()) {
+ auto *Inc = cast<PHINode>(IVPhi->getIncomingValueForBlock(PH));
+ Value *V = ILV.getInductionAdditionalBypassValue(IVPhi);
----------------
ayalz wrote:
Worth also recording and retrieving ILV.getReductionAdditionalBypassValue(), to simplify fixReductionScalarResumeWhenVectorizingEpilog() and align it with fixing induction resumes when vectorizing epilog?
https://github.com/llvm/llvm-project/pull/110577
More information about the llvm-commits
mailing list