Currently `ReturnLike` attaches `RegionBranchTerminatorOpInterface` as a sub trait (see https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td#L384). Consequently, `func::ReturnOp` implements `RegionBranchTerminatorOpInterface`. However, `func::FuncOp` doesn't implement `RegionBranchOpInterface` (see https://github.com/fabianmcg/llvm-project/blob/main/mlir/include/mlir/Dialect/Func/IR/FuncOps.td#L226-L229), resulting on an assert produced by the default implementation of `RegionBranchTerminatorOpInterface`:
```
"void", "getSuccessorRegions",
(ins "::llvm::ArrayRef<::mlir::Attribute>":$operands,
"::llvm::SmallVectorImpl<::mlir::RegionSuccessor> &":$regions), [{}],
/*defaultImplementation=*/[{
::mlir::Operation *op = $_op;
::llvm::cast<::mlir::RegionBranchOpInterface>(op->getParentOp())
.getSuccessorRegions(op->getParentRegion(), regions);
}]
```
Currently
ReturnLike
attachesRegionBranchTerminatorOpInterface
as a sub trait (see https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Interfaces/ControlFlowInterfaces.td#L384). Consequently,func::ReturnOp
implementsRegionBranchTerminatorOpInterface
. However,func::FuncOp
doesn't implementRegionBranchOpInterface
(see https://github.com/llvm/llvm-project/blob/main/mlir/include/mlir/Dialect/Func/IR/FuncOps.td#L226-L229), resulting on an assert produced by the default implementation ofRegionBranchTerminatorOpInterface
: