[llvm] [VPlan] Expand VPWidenIntOrFpInductionRecipe into separate recipes (PR #118638)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 6 03:15:28 PST 2025
================
@@ -2622,6 +2622,19 @@ static void replaceVPBBWithIRVPBB(VPBasicBlock *VPBB, BasicBlock *IRBB) {
}
VPBlockUtils::reassociateBlocks(VPBB, IRVPBB);
+
+ // Replace any references of VPBB in widened phi incoming blocks with IRBB.
+ for (auto *BB : IRVPBB->successors()) {
+ while (auto *Region = dyn_cast<VPRegionBlock>(BB))
+ BB = Region->getEntry();
+
+ for (auto &R : *cast<VPBasicBlock>(BB))
+ if (auto *WidenPhiR = dyn_cast<VPWidenPHIRecipe>(&R))
+ for (unsigned I = 0; I < WidenPhiR->getNumOperands(); I++)
+ if (WidenPhiR->getIncomingBlock(I) == VPBB)
+ WidenPhiR->setIncomingBlock(I, IRVPBB);
+ }
+
----------------
lukel97 wrote:
After c7ebe4fd0afadcddd53ec89e6030f9a8f5370e1f we will crash in fixNonInductionPHIs if we use a VPWidenPHIRecipe with the vector preheader as an incoming block, because the phi will reference the old non-IRBB vector preheader.
The existing native vplan tests don't seem to hit this because they don't create any widened phis that have the vector preheader/scalar preheader/middle block as an incoming block.
https://github.com/llvm/llvm-project/pull/118638
More information about the llvm-commits
mailing list