Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions mlir/lib/Dialect/SCF/IR/SCF.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ struct MultiBlockExecuteInliner : public OpRewritePattern<ExecuteRegionOp> {

LogicalResult matchAndRewrite(ExecuteRegionOp op,
PatternRewriter &rewriter) const override {
if (op.getNoInline())
return failure();
if (!isa<FunctionOpInterface, ExecuteRegionOp>(op->getParentOp()))
return failure();

Expand Down
18 changes: 18 additions & 0 deletions mlir/test/Dialect/SCF/canonicalize.mlir
Original file line number Diff line number Diff line change
Expand Up @@ -1483,6 +1483,24 @@ func.func @execute_region_no_inline() {

// -----

// CHECK-LABEL: func @execute_region_under_func_no_inline
func.func @execute_region_under_func_no_inline() {
"test.foo"() : () -> ()
%v = scf.execute_region -> i64 no_inline {
%x = "test.val"() : () -> i64
scf.yield %x : i64
}
"test.bar"(%v) : (i64) -> ()
return
}

// CHECK-NEXT: "test.foo"() : () -> ()
// CHECK-NEXT: scf.execute_region
// CHECK-NEXT: %[[VAL:.*]] = "test.val"() : () -> i64
// CHECK-NEXT: scf.yield %[[VAL]] : i64

// -----

// CHECK-LABEL: func @func_execute_region_inline
func.func @func_execute_region_inline() {
"test.foo"() : () -> ()
Expand Down
Loading