Skip to content

[mlir][bug] func::ReturnOp::getSuccessorRegions always asserts #112146

Open
@fabianmcg

Description

@fabianmcg

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/llvm/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);
      }]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions