Skip to content

Commit d834bb0

Browse files
committed
Revert "[mlir] add noinline attribute to func.func/call (llvm#119970)"
This reverts commit d072ca1.
1 parent 10073b7 commit d834bb0

File tree

3 files changed

+5
-34
lines changed

3 files changed

+5
-34
lines changed

mlir/include/mlir/Dialect/Func/IR/FuncOps.td

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,7 @@ def CallOp : Func_Op<"call",
4949
```
5050
}];
5151

52-
let arguments = (ins FlatSymbolRefAttr:$callee, Variadic<AnyType>:$operands,
53-
UnitAttr:$no_inline);
52+
let arguments = (ins FlatSymbolRefAttr:$callee, Variadic<AnyType>:$operands);
5453
let results = (outs Variadic<AnyType>);
5554

5655
let builders = [
@@ -271,8 +270,7 @@ def FuncOp : Func_Op<"func", [
271270
TypeAttrOf<FunctionType>:$function_type,
272271
OptionalAttr<StrAttr>:$sym_visibility,
273272
OptionalAttr<DictArrayAttr>:$arg_attrs,
274-
OptionalAttr<DictArrayAttr>:$res_attrs,
275-
UnitAttr:$no_inline);
273+
OptionalAttr<DictArrayAttr>:$res_attrs);
276274
let regions = (region AnyRegion:$body);
277275

278276
let builders = [OpBuilder<(ins

mlir/lib/Dialect/Func/Extensions/InlinerExtension.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,22 +27,18 @@ struct FuncInlinerInterface : public DialectInlinerInterface {
2727
// Analysis Hooks
2828
//===--------------------------------------------------------------------===//
2929

30-
/// Call operations can be inlined unless specified otherwise by attributes
31-
/// on either the call or the callbale.
30+
/// All call operations can be inlined.
3231
bool isLegalToInline(Operation *call, Operation *callable,
3332
bool wouldBeCloned) const final {
34-
auto callOp = dyn_cast<func::CallOp>(call);
35-
auto funcOp = dyn_cast<func::FuncOp>(callable);
36-
return !(callOp && callOp.getNoInline()) &&
37-
!(funcOp && funcOp.getNoInline());
33+
return true;
3834
}
3935

4036
/// All operations can be inlined.
4137
bool isLegalToInline(Operation *, Region *, bool, IRMapping &) const final {
4238
return true;
4339
}
4440

45-
/// All function bodies can be inlined.
41+
/// All functions can be inlined.
4642
bool isLegalToInline(Region *, Region *, bool, IRMapping &) const final {
4743
return true;
4844
}

mlir/test/Transforms/inlining.mlir

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -19,29 +19,6 @@ func.func @inline_with_arg(%arg0 : i32) -> i32 {
1919
return %0 : i32
2020
}
2121

22-
// CHECK-LABEL: func @noinline_with_arg
23-
func.func @noinline_with_arg(%arg0 : i32) -> i32 {
24-
// CHECK-NEXT: func_with_arg
25-
// CHECK-NEXT: return
26-
27-
%0 = call @func_with_arg(%arg0) {no_inline} : (i32) -> i32
28-
return %0 : i32
29-
}
30-
31-
func.func @non_inlinable_func_with_arg(%c : i32) -> i32 attributes {no_inline} {
32-
%b = arith.addi %c, %c : i32
33-
return %b : i32
34-
}
35-
36-
// CHECK-LABEL: func @noinline_with_func_arg
37-
func.func @noinline_with_func_arg(%arg0 : i32) -> i32 {
38-
// CHECK-NEXT: non_inlinable_func_with_arg
39-
// CHECK-NEXT: return
40-
41-
%0 = call @non_inlinable_func_with_arg(%arg0) : (i32) -> i32
42-
return %0 : i32
43-
}
44-
4522
// Inline a function that has multiple return operations.
4623
func.func @func_with_multi_return(%a : i1) -> (i32) {
4724
cf.cond_br %a, ^bb1, ^bb2

0 commit comments

Comments
 (0)