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

Matthias Springer llvmlistbot at llvm.org
Mon Mar 2 04:10:58 PST 2026


================
@@ -558,6 +571,89 @@ func.func @accelerator_compute(i64, i1) -> i64 { // An SSACFG region
 }
 ```
 
+#### Region Terminator
----------------
matthias-springer wrote:

> It's only about performance: it is also about API convenience.
> What if you had to dyn_cast and operation to "HasSSAOperandsOpInterface" before being able to call `op->getOperand(0)`?
> Or `dyn_cast<OpWithRegionOpInterface>(op)->getRegion(0)`?

That would be quite annoying, indeed. But you can always hide it behind a helper function. E.g., `cast<MemoryEffectOpInterface>(op).getEffects().empty()` --> `mlir::isMemoryEffectFree(op)`. (If a function is called many times, you could even define a member function directly on `class Operation` and then dispatch to the interface in the implementation.)

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


More information about the Mlir-commits mailing list