[Mlir-commits] [mlir] 9dc59cc - [MLIR] Incorrect track of usedKey in setPropertiesFromParsedAttr (#144789)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Fri Jun 20 08:02:12 PDT 2025


Author: Chao Chen
Date: 2025-06-20T10:02:09-05:00
New Revision: 9dc59cc95b1766510ab43ec62bb087aa9273341a

URL: https://github.com/llvm/llvm-project/commit/9dc59cc95b1766510ab43ec62bb087aa9273341a
DIFF: https://github.com/llvm/llvm-project/commit/9dc59cc95b1766510ab43ec62bb087aa9273341a.diff

LOG: [MLIR] Incorrect track of usedKey in setPropertiesFromParsedAttr (#144789)

co-authored by @chencha3 and @joker-eph

Added: 
    

Modified: 
    mlir/test/lib/Dialect/Test/TestOps.td
    mlir/test/mlir-tblgen/op-format.mlir
    mlir/tools/mlir-tblgen/OpFormatGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/test/lib/Dialect/Test/TestOps.td b/mlir/test/lib/Dialect/Test/TestOps.td
index 79bcd9c2e0a9a..30234698bc8dd 100644
--- a/mlir/test/lib/Dialect/Test/TestOps.td
+++ b/mlir/test/lib/Dialect/Test/TestOps.td
@@ -3179,7 +3179,7 @@ def TestOpWithPropertiesAndInferredType
   ]> {
   let assemblyFormat = "$lhs prop-dict attr-dict";
 
-  let arguments = (ins I32Attr:$lhs, IntProp<"int64_t">:$rhs);
+  let arguments = (ins I32Attr:$lhs, IntProp<"int64_t">:$rhs, OptionalAttr<UnitAttr>: $packed);
   let results = (outs AnyType:$result);
 }
 

diff  --git a/mlir/test/mlir-tblgen/op-format.mlir b/mlir/test/mlir-tblgen/op-format.mlir
index 08b0c52413a75..981fb5aff2aa2 100644
--- a/mlir/test/mlir-tblgen/op-format.mlir
+++ b/mlir/test/mlir-tblgen/op-format.mlir
@@ -516,8 +516,8 @@ test.format_infer_variadic_type_from_non_variadic %i64, %i64 : i64
 // CHECK: test.with_properties_and_attr 16 < {rhs = 16 : i64}>
 test.with_properties_and_attr 16 <{rhs = 16 : i64}>
 
-// CHECK: test.with_properties_and_inferred_type 16 < {rhs = 16 : i64}>
-%should_be_i32 = test.with_properties_and_inferred_type 16 <{rhs = 16 : i64}>
+// CHECK: test.with_properties_and_inferred_type 16 < {packed, rhs = 16 : i64}>
+%should_be_i32 = test.with_properties_and_inferred_type 16 <{packed, rhs = 16 : i64}>
 // Assert through the verifier that its inferred as i32.
 test.format_all_types_match_var %should_be_i32, %i32 : i32
 

diff  --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index ef3a18ba7df22..11edf2523f1aa 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -1365,7 +1365,7 @@ if (attr && ::mlir::failed(setFromAttr(prop.{1}, attr, emitError)))
 auto &propStorage = prop.{0};
 auto {0}AttrName = StringAttr::get(ctx, "{0}");
 auto attr = dict.get({0}AttrName);
-usedKeys.insert(StringAttr::get(ctx, "{1}"));
+usedKeys.insert({0}AttrName);
 if (attr || /*isRequired=*/{1}) {{
   if (!attr) {{
     emitError() << "expected key entry for {0} in DictionaryAttr to set "


        


More information about the Mlir-commits mailing list