forked from OSchip/llvm-project
[mlir:PDL] Fix assembly format for pdl.apply_native_rewrite
The results of a rewrite are optional, but we currently require them to be present in the assembly format. This commit makes the results component in the format optional. Differential Revision: https://reviews.llvm.org/D114814
This commit is contained in:
parent
e40624ae60
commit
9debc35f02
|
@ -114,8 +114,8 @@ def PDL_ApplyNativeRewriteOp
|
|||
OptionalAttr<ArrayAttr>:$constParams);
|
||||
let results = (outs Variadic<PDL_AnyType>:$results);
|
||||
let assemblyFormat = [{
|
||||
$name ($constParams^)? (`(` $args^ `:` type($args) `)`)? `:` type($results)
|
||||
attr-dict
|
||||
$name ($constParams^)? (`(` $args^ `:` type($args) `)`)?
|
||||
(`:` type($results)^)? attr-dict
|
||||
}];
|
||||
}
|
||||
|
||||
|
|
|
@ -110,3 +110,12 @@ pdl.pattern @infer_type_from_type_used_in_match : benefit(1) {
|
|||
%newOp = pdl.operation "foo.op" -> (%types, %otherTypes : !pdl.range<type>, !pdl.range<type>)
|
||||
}
|
||||
}
|
||||
|
||||
// -----
|
||||
|
||||
pdl.pattern @apply_rewrite_with_no_results : benefit(1) {
|
||||
%root = pdl.operation
|
||||
pdl.rewrite %root {
|
||||
pdl.apply_native_rewrite "NativeRewrite"(%root : !pdl.operation)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue