[llvm] [VPlan] Expand VPWidenIntOrFpInductionRecipe into separate recipes (PR #118638)

Shih-Po Hung via llvm-commits llvm-commits at lists.llvm.org
Tue Jan 7 19:04:57 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);
+  }
+
----------------
arcbbb wrote:

Great find! Tracking this type of use is difficult as VPBasicBlock isn’t a VPValue. It seems we should handle all such uses within reassociateBlocks.

https://github.com/llvm/llvm-project/pull/118638


More information about the llvm-commits mailing list