Skip to content

func.exit

← func dialect

Conditionally return from the nearest enclosing function or kernel body. The exit region uses the return terminator declared by that body and evaluates only when the condition is true.

Operation contract

Property Value
Semantic phase executable
Traits UnknownEffects

Signature

Kind Name Type Cardinality Description
Operand condition i1 required —
Region body region required Work and returned values evaluated only on the taken exit. (single block.)

Examples

func.exit %done : i1 {
  func.return
}
func.exit %found : i1 {
  func.return %value : i32
}
func.exit %done : i1 {
  kernel.return
}