[Mlir-commits] [mlir] [MLIR] Introduce support for early exits (PR #166688)
Matthias Springer
llvmlistbot at llvm.org
Wed Feb 25 05:17:11 PST 2026
================
@@ -98,6 +98,10 @@ def SameOperandsAndResultElementType :
NativeOpTrait<"SameOperandsAndResultElementType">;
// Op is a terminator.
def Terminator : NativeOpTrait<"IsTerminator">;
+// Op is a region terminator for the immediate region only.
+def ImmediateRegionTerminator : NativeOpTrait<"RegionTerminator", [Terminator]>;
+// Op is a region terminator, potentially breaking multiple regions
+def RegionTerminator : NativeOpTrait<"RegionTerminator", [Terminator]>;
----------------
matthias-springer wrote:
Do we actually need `RegionTerminator` as a trait? An op is a region terminator if and only if `numBreakingControlRegions > 0`. (Is that actually the case?)
```c++
/// Return the number of nested region levels this terminator exits.
/// Returns 0 for ordinary operations that are not region terminators.
```
The verification seems to go only one way: you could have (registered) ops with `numBreakingControlRegions > 0` that do not implement the `RegionTerminator` trait. What would be the meaning of such an op?
https://github.com/llvm/llvm-project/pull/166688
More information about the Mlir-commits
mailing list