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

co-authored by @chencha3 and @joker-eph
This commit is contained in:
Chao Chen
2025-06-20 10:02:09 -05:00
committed by GitHub
parent b017b4ce9a
commit 9dc59cc95b
3 changed files with 4 additions and 4 deletions

View File

@@ -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);
}

View File

@@ -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

View File

@@ -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 "