Skip to content

Commit 9dc59cc

Browse files
authored
[MLIR] Incorrect track of usedKey in setPropertiesFromParsedAttr (#144789)
co-authored by @chencha3 and @joker-eph
1 parent b017b4c commit 9dc59cc

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

mlir/test/lib/Dialect/Test/TestOps.td

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3179,7 +3179,7 @@ def TestOpWithPropertiesAndInferredType
31793179
]> {
31803180
let assemblyFormat = "$lhs prop-dict attr-dict";
31813181

3182-
let arguments = (ins I32Attr:$lhs, IntProp<"int64_t">:$rhs);
3182+
let arguments = (ins I32Attr:$lhs, IntProp<"int64_t">:$rhs, OptionalAttr<UnitAttr>: $packed);
31833183
let results = (outs AnyType:$result);
31843184
}
31853185

mlir/test/mlir-tblgen/op-format.mlir

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,8 @@ test.format_infer_variadic_type_from_non_variadic %i64, %i64 : i64
516516
// CHECK: test.with_properties_and_attr 16 < {rhs = 16 : i64}>
517517
test.with_properties_and_attr 16 <{rhs = 16 : i64}>
518518

519-
// CHECK: test.with_properties_and_inferred_type 16 < {rhs = 16 : i64}>
520-
%should_be_i32 = test.with_properties_and_inferred_type 16 <{rhs = 16 : i64}>
519+
// CHECK: test.with_properties_and_inferred_type 16 < {packed, rhs = 16 : i64}>
520+
%should_be_i32 = test.with_properties_and_inferred_type 16 <{packed, rhs = 16 : i64}>
521521
// Assert through the verifier that its inferred as i32.
522522
test.format_all_types_match_var %should_be_i32, %i32 : i32
523523

mlir/tools/mlir-tblgen/OpFormatGen.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1365,7 +1365,7 @@ if (attr && ::mlir::failed(setFromAttr(prop.{1}, attr, emitError)))
13651365
auto &propStorage = prop.{0};
13661366
auto {0}AttrName = StringAttr::get(ctx, "{0}");
13671367
auto attr = dict.get({0}AttrName);
1368-
usedKeys.insert(StringAttr::get(ctx, "{1}"));
1368+
usedKeys.insert({0}AttrName);
13691369
if (attr || /*isRequired=*/{1}) {{
13701370
if (!attr) {{
13711371
emitError() << "expected key entry for {0} in DictionaryAttr to set "

0 commit comments

Comments
 (0)