[llvm] [VPlan] Replace VPRegionBlock with explicit CFG before execute (NFCI). (PR #117506)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed May 14 02:19:02 PDT 2025


================
@@ -420,12 +433,17 @@ void VPBasicBlock::connectToPredecessors(VPTransformState &State) {
   if (ParentLoop && !State.LI->getLoopFor(NewBB))
     ParentLoop->addBasicBlockToLoop(NewBB, *State.LI);
 
+  auto Preds = to_vector(getHierarchicalPredecessors());
+  if (VPBlockUtils::isHeader(this, State.VPDT)) {
+    // There's no block yet for the latch, don't try to connect it yet.
----------------
fhahn wrote:

Updated thanks. We could create both predecessors and successors for blocks if they don't exist yet, but that would be a bigger change. Once we also unroll replicate regions for VF, it would be possible to do an initial pass over the whole plan, create all IR BBs w/o connecting them and a second pass creating the instructions in the block + connecting them.

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


More information about the llvm-commits mailing list