[llvm] [VPlan] Introduce child regions as VPlan transform. (PR #129402)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 7 02:20:47 PDT 2025
================
@@ -376,23 +311,21 @@ void PlainCFGBuilder::buildPlainCFG(
for (BasicBlock *BB : RPO) {
// Create or retrieve the VPBasicBlock for this BB.
VPBasicBlock *VPBB = getOrCreateVPBB(BB);
- VPRegionBlock *Region = VPBB->getParent();
Loop *LoopForBB = LI->getLoopFor(BB);
// Set VPBB predecessors in the same order as they are in the incoming BB.
if (!isHeaderBB(BB, LoopForBB)) {
setVPBBPredsFromBB(VPBB, BB);
- } else if (Region) {
- // BB is a loop header and there's a corresponding region, set the
- // predecessor for it.
- setRegionPredsFromBB(Region, BB);
+ } else {
+ VPBB->setPredecessors({getOrCreateVPBB(LoopForBB->getLoopPredecessor()),
+ getOrCreateVPBB(LoopForBB->getLoopLatch())});
}
// Create VPInstructions for BB.
createVPInstructionsForVPBB(VPBB, BB);
----------------
ayalz wrote:
Assumptions about successors and successor order should be consistent with terminating recipes that target them, including the removal of early-exit branches/successors. Perhaps similar to [header]phisToFix/fixHeaderPhis() that should arguably post-process predecessors to align with phi recipes as they are fixed, after first mirroring the IR predecessors as-is, a post-processing of VPIRInstructions that first wrap IR terminals should take care of both converting them into BranchOnCond/Switch VP[nonIR]Instructions along with possible swapping of successors, plus removal of early-exit branches? Can be done separately if preferred.
https://github.com/llvm/llvm-project/pull/129402
More information about the llvm-commits
mailing list