[llvm] [VPlan] Introduce child regions as VPlan transform. (PR #129402)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 13 04:47:29 PDT 2025


================
@@ -130,43 +98,23 @@ void PlainCFGBuilder::fixHeaderPhis() {
     auto *VPPhi = cast<VPWidenPHIRecipe>(VPVal);
     assert(VPPhi->getNumOperands() == 0 &&
            "Expected VPInstruction with no operands.");
-
-    Loop *L = LI->getLoopFor(Phi->getParent());
-    assert(isHeaderBB(Phi->getParent(), L));
+    assert(isHeaderBB(Phi->getParent(), LI->getLoopFor(Phi->getParent())));
     // For header phis, make sure the incoming value from the loop
     // predecessor is the first operand of the recipe.
     assert(Phi->getNumOperands() == 2 &&
            "header phi must have exactly 2 operands");
-    BasicBlock *LoopPred = L->getLoopPredecessor();
-    VPPhi->addOperand(
-        getOrCreateVPOperand(Phi->getIncomingValueForBlock(LoopPred)));
-    BasicBlock *LoopLatch = L->getLoopLatch();
-    VPPhi->addOperand(
-        getOrCreateVPOperand(Phi->getIncomingValueForBlock(LoopLatch)));
+    for (BasicBlock *Pred : predecessors(Phi->getParent()))
+      VPPhi->addOperand(
+          getOrCreateVPOperand(Phi->getIncomingValueForBlock(Pred)));
   }
 }
 
 static bool isHeaderVPBB(VPBasicBlock *VPBB) {
   return VPBB->getParent() && VPBB->getParent()->getEntry() == VPBB;
 }
----------------
fhahn wrote:

Removed, thanks

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


More information about the llvm-commits mailing list