[Mlir-commits] [mlir] [MLIR][Func] Enable strict property assembly format (PR #217300)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed Aug 19 04:00:44 PDT 2026


llvmorg-github-actions[bot] wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Mehdi Amini (joker-eph)

<details>
<summary>Changes</summary>

Enable the strict properties assembly format mode for the Func dialect. Spell inherent call attributes directly in the call formats so they are no longer parsed from attr-dict in strict mode.

Assisted-by: Codex

---
Full diff: https://github.com/llvm/llvm-project/pull/217300.diff


3 Files Affected:

- (modified) mlir/include/mlir/Dialect/Func/IR/FuncOps.td (+15-2) 
- (modified) mlir/test/IR/core-ops.mlir (+12) 
- (modified) mlir/test/Transforms/inlining.mlir (+1-1) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
index a31b860276099..7b05a0ae77e97 100644
--- a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
+++ b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
@@ -22,6 +22,7 @@ def Func_Dialect : Dialect {
   let name = "func";
   let cppNamespace = "::mlir::func";
   let hasConstantMaterializer = 1;
+  let useStrictPropertiesInAssemblyFormat = 1;
 }
 
 // Base class for Func dialect ops.
@@ -120,7 +121,14 @@ def CallOp : Func_Op<"call",
   }];
 
   let assemblyFormat = [{
-    $callee `(` $operands `)` attr-dict `:` functional-type($operands, results)
+    $callee `(` $operands `)`
+    oilist(
+        `arg_attrs` `=` $arg_attrs
+      | `res_attrs` `=` $res_attrs
+      | `no_inline` $no_inline
+    )
+    attr-dict `:`
+    functional-type($operands, results)
   }];
 }
 
@@ -197,7 +205,12 @@ def CallIndirectOp : Func_Op<"call_indirect", [
 
   let hasCanonicalizeMethod = 1;
   let assemblyFormat = [{
-    $callee `(` $callee_operands `)` attr-dict `:` type($callee)
+    $callee `(` $callee_operands `)`
+    oilist(
+        `arg_attrs` `=` $arg_attrs
+      | `res_attrs` `=` $res_attrs
+    )
+    attr-dict `:` type($callee)
   }];
 }
 
diff --git a/mlir/test/IR/core-ops.mlir b/mlir/test/IR/core-ops.mlir
index 5d1583111541c..29008546f159a 100644
--- a/mlir/test/IR/core-ops.mlir
+++ b/mlir/test/IR/core-ops.mlir
@@ -201,6 +201,18 @@ func.func @calls(%arg0: i32) {
   // CHECK: %4 = call_indirect %f_0(%arg0) : (i32) -> i32
   %3 = "func.call_indirect"(%f_0, %arg0) : ((i32) -> i32, i32) -> i32
 
+  // CHECK: %{{.*}} = call @return_op(%arg0)
+  // CHECK-SAME: arg_attrs = [{test.arg}]
+  // CHECK-SAME: res_attrs = [{test.res = 42 : i64}] no_inline : (i32) -> i32
+  %4 = call @return_op(%arg0) res_attrs = [{test.res = 42 : i64}]
+      no_inline arg_attrs = [{test.arg}] : (i32) -> i32
+
+  // CHECK: %{{.*}} = call_indirect %f_0(%arg0)
+  // CHECK-SAME: arg_attrs = [{test.arg}]
+  // CHECK-SAME: res_attrs = [{test.res = 42 : i64}] : (i32) -> i32
+  %5 = call_indirect %f_0(%arg0) res_attrs = [{test.res = 42 : i64}]
+      arg_attrs = [{test.arg}] : (i32) -> i32
+
   return
 }
 
diff --git a/mlir/test/Transforms/inlining.mlir b/mlir/test/Transforms/inlining.mlir
index da3f1a28deaac..56c17f263e172 100644
--- a/mlir/test/Transforms/inlining.mlir
+++ b/mlir/test/Transforms/inlining.mlir
@@ -28,7 +28,7 @@ func.func @noinline_with_arg(%arg0 : i32) -> i32 {
   // CHECK-NEXT: func_with_arg
   // CHECK-NEXT: return
 
-  %0 = call @func_with_arg(%arg0) {no_inline} : (i32) -> i32
+  %0 = call @func_with_arg(%arg0) no_inline : (i32) -> i32
   return %0 : i32
 }
 

``````````

</details>


https://github.com/llvm/llvm-project/pull/217300


More information about the Mlir-commits mailing list