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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 9 02:21:07 PDT 2025


================
@@ -113,13 +88,6 @@ static bool isHeaderBB(BasicBlock *BB, Loop *L) {
   return L && BB == L->getHeader();
 }
 
-void PlainCFGBuilder::setRegionPredsFromBB(VPRegionBlock *Region,
-                                           BasicBlock *BB) {
-  // BB is a loop header block. Connect the region to the loop preheader.
-  Loop *LoopOfBB = LI->getLoopFor(BB);
-  Region->setPredecessors({getOrCreateVPBB(LoopOfBB->getLoopPredecessor())});
-}
-
 // Add operands to VPInstructions representing phi nodes from the input IR.
 void PlainCFGBuilder::fixHeaderPhis() {
   for (auto *Phi : PhisToFix) {
----------------
fhahn wrote:

Previosuly it wasnt consistent, but with the current patch it is; both use the order from the CFG in the current version and are a 1-1 translation of the CFG.

In the current patch, the canonicalization of header phi operand and header predecessor order is done completely separate from CFG construction, when the region is introduced.

In general, I think we should move away from directly relying on the operands to retrieve incoming values and move towards an interface `getIncomingValueFor(VPB)`, which takes care of checking what the index for `VPB` is.

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


More information about the llvm-commits mailing list