forked from OSchip/llvm-project
[mlir:PDL] Adjust the assembly format for AttributeOp to avoid conflicts with DictionaryAttr
Switch the attribute creation operations to use attr-dict-with- keyword to avoid conflicts (in the case of pdl.attribute) and confusion(in the case of pdl_interp.create_attribute) with having a DictionaryAttr as a value and specifying the attributes of the operation itself (as a dictionary). Differential Revision: https://reviews.llvm.org/D114815
This commit is contained in:
parent
9debc35f02
commit
98f5bd3489
|
@ -152,7 +152,7 @@ def PDL_AttributeOp : PDL_Op<"attribute"> {
|
|||
let arguments = (ins Optional<PDL_Type>:$type,
|
||||
OptionalAttr<AnyAttr>:$value);
|
||||
let results = (outs PDL_Attribute:$attr);
|
||||
let assemblyFormat = "attr-dict (`:` $type^)? ($value^)?";
|
||||
let assemblyFormat = "(`:` $type^)? ($value^)? attr-dict-with-keyword";
|
||||
|
||||
let builders = [
|
||||
OpBuilder<(ins CArg<"Value", "Value()">:$type), [{
|
||||
|
|
|
@ -413,7 +413,7 @@ def PDLInterp_CreateAttributeOp
|
|||
|
||||
let arguments = (ins AnyAttr:$value);
|
||||
let results = (outs PDL_Attribute:$attribute);
|
||||
let assemblyFormat = "$value attr-dict";
|
||||
let assemblyFormat = "$value attr-dict-with-keyword";
|
||||
|
||||
let builders = [
|
||||
OpBuilder<(ins "Attribute":$value), [{
|
||||
|
|
|
@ -119,3 +119,13 @@ pdl.pattern @apply_rewrite_with_no_results : benefit(1) {
|
|||
pdl.apply_native_rewrite "NativeRewrite"(%root : !pdl.operation)
|
||||
}
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
pdl.pattern @attribute_with_dict : benefit(1) {
|
||||
%root = pdl.operation
|
||||
pdl.rewrite %root {
|
||||
%attr = pdl.attribute {some_unit_attr} attributes {pdl.special_attribute}
|
||||
pdl.apply_native_rewrite "NativeRewrite"(%attr : !pdl.attribute)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue