[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:22 PST 2025


================
@@ -592,25 +592,26 @@ static bool hasConditionalTerminator(const VPBasicBlock *VPBB) {
   }
 
   const VPRecipeBase *R = &VPBB->back();
-  bool IsSwitch = isa<VPInstruction>(R) &&
-                  cast<VPInstruction>(R)->getOpcode() == Instruction::Switch;
-  bool IsCondBranch =
+  [[maybe_unused]] bool IsSwitch =
+      isa<VPInstruction>(R) &&
+      cast<VPInstruction>(R)->getOpcode() == Instruction::Switch;
+  [[maybe_unused]] bool IsBranchOnTwoConds = match(R, m_BranchOnTwoConds());
+  [[maybe_unused]] bool IsCondBranch =
       isa<VPBranchOnMaskRecipe>(R) ||
       match(R, m_CombineOr(m_BranchOnCond(), m_BranchOnCount()));
-  (void)IsCondBranch;
-  (void)IsSwitch;
   if (VPBB->getNumSuccessors() == 2 ||
       (VPBB->isExiting() && !VPBB->getParent()->isReplicator())) {
----------------
fhahn wrote:

I think exiting would need to get the region's number of successors, for the region based version of the CFG. As suggested below, will try to unify this separately.

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


More information about the llvm-commits mailing list