[llvm] [VPlan] Replace VPRegionBlock with explicit CFG before execute (NFCI). (PR #117506)
via llvm-commits
llvm-commits at lists.llvm.org
Sun May 11 05:02:07 PDT 2025
================
@@ -207,6 +207,11 @@ VPBlockBase *VPBlockBase::getEnclosingBlockWithPredecessors() {
return Parent->getEnclosingBlockWithPredecessors();
}
+bool VPBasicBlock::isHeader(const VPDominatorTree &VPDT) const {
+ return getPredecessors().size() == 2 &&
+ VPDT.dominates(this, getPredecessors()[1]);
+}
+
----------------
ayalz wrote:
Perhaps BlockUtils should provide an `isHeader(VPBasicBlock& VPBB, const VPDominatorTree &VPDT)`, which could first check if VPBB is inside a loop region? I.e., works in both HCFG and CFG modes.
Another option to identify header blocks after dismantling regions (and possibly also before), rather than depending on external control flow nor dominance info, is by depending on the block's internal content - a block is a header iff its first recipe is a header phi. If VPWidenPHIRecipes and/or VPPhi VPInstructions may reside in header and need to be identified as such (in addition to VPHeaderPhiRecipes), they could be defined as `VPWidenMuRecipes` and `VPMu`'s instead, respectively, to check if `isa<VPHeaderPhiRecipe, VPWidenMuRecipe, VPMu>`. And/or have a `VPMuAccessors` trait which adds start & backedge values API to VPPhiAccessors. Sounds reasonable?
https://github.com/llvm/llvm-project/pull/117506
More information about the llvm-commits
mailing list