[llvm] [VPlan] Add BranchOnMultiCond, use for early exit plans. (PR #172750)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 29 02:36:43 PST 2025
================
@@ -391,20 +391,21 @@ static bool hasDuplicates(const SmallVectorImpl<VPBlockBase *> &VPBlockVec) {
bool VPlanVerifier::verifyBlock(const VPBlockBase *VPB) {
auto *VPBB = dyn_cast<VPBasicBlock>(VPB);
// Check block's condition bit.
- if (!isa<VPIRBasicBlock>(VPB)) {
+ if (VPBB && !isa<VPIRBasicBlock>(VPB)) {
+ // VPRegionBlocks can have multiple successors (e.g., with
+ // BranchOnTwoConds) without needing a terminator, so only check
+ // VPBasicBlocks.
if (VPB->getNumSuccessors() > 1 ||
- (VPBB && VPBB->getParent() && VPBB->isExiting() &&
+ (VPBB->getParent() && VPBB->isExiting() &&
!VPBB->getParent()->isReplicator())) {
----------------
ayalz wrote:
ok, but a similar
```
if (VPBB->getNumSuccessors() == 2 ||
(VPBB->isExiting() && !VPBB->getParent()->isReplicator())) {
```
also appears in `hasConditionalTerminator()` above, hence the thought of providing something common like
```
unsigned getNumCFGSuccessors(VPBB) {
unsigned NumSuccessors = VPBB->getNumSuccessors();
if (!VPBB->isExiting())
return NumSuccessors;
// NumSuccessors is zero, need to consider parent's successors instead.
auto *Parent = VPBB->getParent();
NumSuccessors = Parent->getNumSuccessors();
// Account for implicit backedge.
if (!Parent->isReplicator())
++NumSuccessors;
return NumSuccessors;
}
```
somewhat consistent with `getCFGPredecessor(Index)`.
Anyhow, can be done independently.
https://github.com/llvm/llvm-project/pull/172750
More information about the llvm-commits
mailing list