[llvm] [VPlan] Add BranchOnTwoConds, use for early exit plans. (PR #172750)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 29 10:40:20 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())) {
----------------
fhahn wrote:

Sounds good, will check independently, thanks

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


More information about the llvm-commits mailing list