[Mlir-commits] [mlir] [MLIR] Introduce support for early exits (PR #166688)
Tim Noack
llvmlistbot at llvm.org
Sat Mar 7 23:23:31 PST 2026
timnoack wrote:
I am gradually gonna post some feedback as we experimentally refactor our language frontend towards early exits:
1. When an op has both `HasNestedTerminator<[...]>` and `HasBreakingControlFlowOpInterface` (which is the intended usage pattern in most cases I guess?), C++ multiple inheritance causes ambiguous name lookup for acceptsTerminator:
- HasNestedTerminators<...>::Impl provides static bool acceptsTerminator(Operation*)
- HasBreakingControlFlowOpInterface::Trait provides static bool acceptsTerminator(Operation*) (default returning true)
SCF's LoopOp works around this with an explicit `acceptsTerminator` in extraClassDeclaration, but this defeats the purpose of `HasNestedTerminator` (and forces you to specify the allowed terminators twice).
Possible fix: Remove the defaultImplementation from `acceptsTerminator` in `HasBreakingControlFlowOpInterface`. Then `HasNestedTerminator` provides it without ambiguity, and ops without `HasNestedTerminator` must write it explicitly.
https://github.com/llvm/llvm-project/pull/166688
More information about the Mlir-commits
mailing list