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

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 23 14:26:23 PST 2025


================
@@ -3694,6 +3694,60 @@ void VPlanTransforms::dissolveLoopRegions(VPlan &Plan) {
     R->dissolveToCFGLoop();
 }
 
+void VPlanTransforms::expandBranchOnMultiCond(VPlan &Plan) {
+  // Expand BranchOnMultiCond instructions into explicit CFG with branching.
+  // This must run after dissolveLoopRegions, when successors have been
+  // restored.
+  SmallVector<VPBasicBlock *> WorkList;
+  for (VPBasicBlock *VPBB : VPBlockUtils::blocksOnly<VPBasicBlock>(
+           vp_depth_first_shallow(Plan.getEntry()))) {
+    if (VPBB->empty())
+      continue;
+    if (match(&VPBB->back(), m_BranchOnMultiCond()))
----------------
fhahn wrote:

Merged, thanks

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


More information about the llvm-commits mailing list