[Mlir-commits] [mlir] 7143e33 - Adopt Properties to store operations inherent Attributes in the Func dialect

Mehdi Amini llvmlistbot at llvm.org
Tue May 2 20:57:06 PDT 2023


Author: Mehdi Amini
Date: 2023-05-02T20:56:31-07:00
New Revision: 7143e3335d92b9f2a987cfccb65461e186af7f4b

URL: https://github.com/llvm/llvm-project/commit/7143e3335d92b9f2a987cfccb65461e186af7f4b
DIFF: https://github.com/llvm/llvm-project/commit/7143e3335d92b9f2a987cfccb65461e186af7f4b.diff

LOG: Adopt Properties to store operations inherent Attributes in the Func dialect

This is part of an on-going migration to adopt Properties inside MLIR.

Differential Revision: https://reviews.llvm.org/D148297

Added: 
    

Modified: 
    mlir/include/mlir/Dialect/Func/IR/FuncOps.td
    mlir/test/IR/print-ir-invalid.mlir
    mlir/test/IR/wrapping_op.mlir
    mlir/test/mlir-lsp-server/hover.test

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
index 1a06d6533b2d0..4204bc576970f 100644
--- a/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
+++ b/mlir/include/mlir/Dialect/Func/IR/FuncOps.td
@@ -23,6 +23,7 @@ def Func_Dialect : Dialect {
   let cppNamespace = "::mlir::func";
   let dependentDialects = ["cf::ControlFlowDialect"];
   let hasConstantMaterializer = 1;
+  let usePropertiesForAttributes = 1;
 }
 
 // Base class for Func dialect ops.

diff  --git a/mlir/test/IR/print-ir-invalid.mlir b/mlir/test/IR/print-ir-invalid.mlir
index 70a0b90d53683..46b34e5f8b63e 100644
--- a/mlir/test/IR/print-ir-invalid.mlir
+++ b/mlir/test/IR/print-ir-invalid.mlir
@@ -8,10 +8,9 @@ module {}
 // The operation is invalid because the body does not have a terminator, print
 // the generic form.
 // CHECK:      Invalid operation:
-// CHECK-NEXT: "func.func"() ({
+// CHECK-NEXT: "func.func"() <{function_type = () -> (), sym_name = "test"}> ({
 // CHECK-NEXT: ^bb0:
 // CHECK-NEXT: })
-// CHECK-SAME: sym_name = "test"
 
 // The operation is valid because the body has a terminator, print the custom
 // form.

diff  --git a/mlir/test/IR/wrapping_op.mlir b/mlir/test/IR/wrapping_op.mlir
index 1c3992917d6e7..3f7a350ee654e 100644
--- a/mlir/test/IR/wrapping_op.mlir
+++ b/mlir/test/IR/wrapping_op.mlir
@@ -3,6 +3,7 @@
 
 // CHECK-LABEL: func @wrapping_op
 // CHECK-GENERIC: "func.func"
+// CHECK-GENERIC-SAME: sym_name = "wrapping_op"
 func.func @wrapping_op(%arg0 : i32, %arg1 : f32) -> (i3, i2, i1) {
 // CHECK: %0:3 = test.wrapping_region wraps "some.op"(%arg1, %arg0) {test.attr = "attr"} : (f32, i32) -> (i1, i2, i3)
 // CHECK-GENERIC: "test.wrapping_region"() ({
@@ -12,4 +13,3 @@ func.func @wrapping_op(%arg0 : i32, %arg1 : f32) -> (i3, i2, i1) {
   %res:3 = test.wrapping_region wraps "some.op"(%arg1, %arg0) { test.attr = "attr" } : (f32, i32) -> (i1, i2, i3) loc("some_NameLoc")
   return %res#2, %res#1, %res#0 : i3, i2, i1
 }
-// CHECK-GENERIC: sym_name = "wrapping_op"

diff  --git a/mlir/test/mlir-lsp-server/hover.test b/mlir/test/mlir-lsp-server/hover.test
index 3a8a4437bc533..5f5304823dff0 100644
--- a/mlir/test/mlir-lsp-server/hover.test
+++ b/mlir/test/mlir-lsp-server/hover.test
@@ -114,7 +114,7 @@
 // CHECK-NEXT:  "result": {
 // CHECK-NEXT:    "contents": {
 // CHECK-NEXT:      "kind": "markdown",
-// CHECK-NEXT:      "value": "\"func.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"func.func\"() ({...}) {function_type = (i1) -> (), sym_name = \"foo\"} : () -> ()\n```\n"
+// CHECK-NEXT:      "value": "\"func.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"func.func\"() <{function_type = (i1) -> (), sym_name = \"foo\"}> ({...}) : () -> ()\n```\n"
 // CHECK-NEXT:    },
 // CHECK-NEXT:    "range": {
 // CHECK-NEXT:      "end": {
@@ -138,7 +138,7 @@
 // CHECK-NEXT:  "result": {
 // CHECK-NEXT:    "contents": {
 // CHECK-NEXT:      "kind": "markdown",
-// CHECK-NEXT:      "value": "\"func.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"func.func\"() ({...}) {function_type = (i1) -> (), sym_name = \"foo\"} : () -> ()\n```\n"
+// CHECK-NEXT:      "value": "\"func.func\" : public @foo\n\nGeneric Form:\n\n```mlir\n\"func.func\"() <{function_type = (i1) -> (), sym_name = \"foo\"}> ({...}) : () -> ()\n```\n"
 // CHECK-NEXT:    },
 // CHECK-NEXT:    "range": {
 // CHECK-NEXT:      "end": {


        


More information about the Mlir-commits mailing list