[Mlir-commits] [mlir] 3c2e2df - [MLIR][ODS] Add constBuilderCall for TypeArrayAttr
Andy Ly
llvmlistbot at llvm.org
Fri Sep 18 09:14:53 PDT 2020
Author: Andy Ly
Date: 2020-09-18T16:14:41Z
New Revision: 3c2e2df8d03e8ac8e7be1733950993090f2b4710
URL: https://github.com/llvm/llvm-project/commit/3c2e2df8d03e8ac8e7be1733950993090f2b4710
DIFF: https://github.com/llvm/llvm-project/commit/3c2e2df8d03e8ac8e7be1733950993090f2b4710.diff
LOG: [MLIR][ODS] Add constBuilderCall for TypeArrayAttr
constBuilderCall was not defined for TypeArrayAttr, resulting in tblgen not emitting the correct code when TypeArrayAttr is used with a default valued attribute.
Reviewed By: antiagainst
Differential Revision: https://reviews.llvm.org/D87907
Added:
Modified:
mlir/include/mlir/IR/OpBase.td
mlir/test/lib/Dialect/Test/TestOps.td
Removed:
################################################################################
diff --git a/mlir/include/mlir/IR/OpBase.td b/mlir/include/mlir/IR/OpBase.td
index d314393caae2..330cdca6c0ab 100644
--- a/mlir/include/mlir/IR/OpBase.td
+++ b/mlir/include/mlir/IR/OpBase.td
@@ -1432,7 +1432,7 @@ def StrArrayAttr : TypedArrayAttrBase<StrAttr, "string array attribute"> {
let constBuilderCall = "$_builder.getStrArrayAttr($0)";
}
def TypeArrayAttr : TypedArrayAttrBase<TypeAttr, "type array attribute"> {
- let constBuilderCall = ?;
+ let constBuilderCall = "$_builder.getTypeArrayAttr($0)";
}
// Attribute information for an Attribute field within a StructAttr.
diff --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index 2a3f5929f08e..bbff81884542 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -168,6 +168,9 @@ def PositiveIntAttrOp : TEST_Op<"positive_int_attr"> {
def TypeArrayAttrOp : TEST_Op<"type_array_attr"> {
let arguments = (ins TypeArrayAttr:$attr);
}
+def TypeArrayAttrWithDefaultOp : TEST_Op<"type_array_attr_with_default"> {
+ let arguments = (ins DefaultValuedAttr<TypeArrayAttr, "{}">:$attr);
+}
def TypeStringAttrWithTypeOp : TEST_Op<"string_attr_with_type"> {
let arguments = (ins TypedStrAttr<AnyType>:$attr);
let assemblyFormat = "$attr attr-dict";
More information about the Mlir-commits
mailing list