[Mlir-commits] [mlir] 5568ce0 - [mlir][transform] Fix merge_handle asm format
Christian Ulmann
llvmlistbot at llvm.org
Wed May 24 02:44:08 PDT 2023
Author: Christian Ulmann
Date: 2023-05-24T09:42:09Z
New Revision: 5568ce058035dd6cf7fb922652ae91054c969062
URL: https://github.com/llvm/llvm-project/commit/5568ce058035dd6cf7fb922652ae91054c969062
DIFF: https://github.com/llvm/llvm-project/commit/5568ce058035dd6cf7fb922652ae91054c969062.diff
LOG: [mlir][transform] Fix merge_handle asm format
This commit ensures that the merge_handles operation prints its
`deduplicate` attribute as an optional keyword instead of "unit".
Reviewed By: ftynse
Differential Revision: https://reviews.llvm.org/D151310
Added:
Modified:
mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
mlir/test/Dialect/Transform/test-interpreter.mlir
Removed:
################################################################################
diff --git a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
index 525698274ab78..aa88e49511062 100644
--- a/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
+++ b/mlir/include/mlir/Dialect/Transform/IR/TransformOps.td
@@ -441,7 +441,7 @@ def MergeHandlesOp : TransformDialectOp<"merge_handles",
let arguments = (ins Variadic<TransformHandleTypeInterface>:$handles,
UnitAttr:$deduplicate);
let results = (outs TransformHandleTypeInterface:$result);
- let assemblyFormat = "($deduplicate^)? $handles attr-dict `:` type($result)";
+ let assemblyFormat = "(`deduplicate` $deduplicate^)? $handles attr-dict `:` type($result)";
let hasFolder = 1;
}
diff --git a/mlir/test/Dialect/Transform/test-interpreter.mlir b/mlir/test/Dialect/Transform/test-interpreter.mlir
index 22a06de393e94..11a556877f5f6 100644
--- a/mlir/test/Dialect/Transform/test-interpreter.mlir
+++ b/mlir/test/Dialect/Transform/test-interpreter.mlir
@@ -555,6 +555,32 @@ transform.with_pdl_patterns {
// -----
+func.func @foo(%arg0: index) {
+ %0 = arith.addi %arg0, %arg0 : index
+ return
+}
+
+transform.with_pdl_patterns {
+^bb0(%arg0: !transform.any_op):
+ pdl.pattern @addi : benefit(1) {
+ %0 = pdl.operands
+ %1 = pdl.types
+ %2 = pdl.operation "arith.addi"(%0 : !pdl.range<value>) -> (%1 : !pdl.range<type>)
+ pdl.rewrite %2 with "transform.dialect"
+ }
+
+ transform.sequence %arg0 : !transform.any_op failures(propagate) {
+ ^bb0(%arg1: !transform.any_op):
+ %0 = pdl_match @addi in %arg1 : (!transform.any_op) -> !transform.any_op
+ %1 = pdl_match @addi in %arg1 : (!transform.any_op) -> !transform.any_op
+ %2 = merge_handles deduplicate %0, %1 : !transform.any_op
+ // expected-remark @below {{1}}
+ test_print_number_of_associated_payload_ir_ops %2 : !transform.any_op
+ }
+}
+
+// -----
+
func.func @foo() {
"op" () { target_me } : () -> ()
// expected-note @below {{when applied to this op}}
More information about the Mlir-commits
mailing list