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

via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 24 15:51:10 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())) {
----------------
ayalz wrote:

Specifically account for implicit backedge?
```suggestion
  unsigned NumSuccessors = VPBB->getNumSuccessors();
  if (VPBB->isExiting() && !VPBB->getParent()->isReplicator())
    ++NumSuccessors;
  if (NumSuccessors == 2) {
```
continue to expect only BranchOnCond or Switch only

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


More information about the llvm-commits mailing list