[Mlir-commits] [mlir] [MLIR] Introduce support for early exits (PR #166688)
Matthias Springer
llvmlistbot at llvm.org
Thu Feb 26 05:59:03 PST 2026
================
@@ -558,6 +571,89 @@ func.func @accelerator_compute(i64, i1) -> i64 { // An SSACFG region
}
```
+#### Region Terminator
----------------
matthias-springer wrote:
The fundamental question is: When should something get special treatment in `class OperationState`? And when is it better to use interfaces and traits? (Also, how much should be specified in the LangRef?)
Having a small `OperationState` (and LangRef) is a nice property because it keeps the "core" of the language small. So generally speaking, I would opt for interfaces/traits unless there's a good reason why it cannot be done that way or limits usability.
Some data points:
- There is currently no special treatment for terminators. I.e., there is no `bool isTerminator;` in `OperationState`. We have `OpTrait::IsTerminator` instead. (But terminators are mentioned in the LangRef.)
- There is currently no special treatment for region terminators. We have `RegionBranchTerminatorOpInterface` instead. (Not mentioned in the LangRef.)
- There is currently no special treatment for SSACFG/graph regions. We have `RegionKindInterface` interface instead. (Mentioned in the LangRef.)
- There is currently no special treatment for isolated-from-above. We have `OpTrait::IsIsolatedFromAbove` instead. (Mentioned in the LangRef.)
Unless "breaking exit regions" is more fundamental to the language than these kind of language features, I would try a trait/interface-based design first. And maybe promote into `OperationState` later if we see a need.
https://github.com/llvm/llvm-project/pull/166688
More information about the Mlir-commits
mailing list