[Mlir-commits] [mlir] [MLIR] Introduce support for early exits (PR #166688)

Matthias Springer llvmlistbot at llvm.org
Fri Jun 12 03:18:11 PDT 2026


================
@@ -423,11 +435,35 @@ inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
 
 inline llvm::raw_ostream &operator<<(llvm::raw_ostream &os,
                                      RegionSuccessor successor) {
+  if (successor.isPropagating())
+    return os << "<propagating>";
   if (successor.isParent())
     return os << "<to parent>";
   return os << "<to region #" << successor.getSuccessor()->getRegionNumber()
             << ">";
 }
+
+/// Return the RegionBranchOpInterface that actually receives control flow from
+/// `terminator`. For a terminator with a single potential target that
+/// propagates a break to an ancestor (the immediate parent returns a
+/// `RegionSuccessor::propagating()` sentinel), this is the addressed
+/// HasBreakingControlFlowOpInterface ancestor; otherwise it is the terminator's
+/// immediate parent. Returns null if the effective branch does not implement
+/// RegionBranchOpInterface. Unlike
+/// `resolveTerminatorSuccessors`, this does not materialize the successor list.
+RegionBranchOpInterface
+resolveEffectiveBranch(RegionBranchTerminatorOpInterface terminator);
----------------
matthias-springer wrote:

This should return a `SmallVector<RegionBranchOpInterface>`.

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


More information about the Mlir-commits mailing list