[Mlir-commits] [mlir] [MLIR][Transform] Add attribute in MatchOp to filter by operand type (PR #67994)
Pablo Antonio Martinez
llvmlistbot at llvm.org
Fri Nov 10 03:31:46 PST 2023
================
@@ -39,6 +39,55 @@ transform.sequence failures(propagate) {
// -----
+func.func @by_operand_type() {
+ %c0 = arith.constant 1.0: f32
+ // expected-remark @below {{matched op name}}
+ %res = arith.fptoui %c0 : f32 to i32
+ return
+}
+
+transform.sequence failures(propagate) {
+^bb1(%arg1: !transform.any_op):
+ %match_name = transform.structured.match
+ ops{["arith.fptoui"]} filter_operand_type = f32 in %arg1 : (!transform.any_op) -> !transform.any_op
+ transform.test_print_remark_at_operand %match_name, "matched op name" : !transform.any_op
+ transform.test_consume_operand %match_name : !transform.any_op
+}
+
+// -----
+
+func.func @by_operand_type_negative_match() {
+ %c0 = arith.constant 1.0: f32
+ %res = arith.fptoui %c0 : f32 to i32
+ return
+}
+
+transform.sequence failures(propagate) {
+^bb1(%arg1: !transform.any_op):
+ %match_name = transform.structured.match
+ ops{["arith.fptoui"]} filter_operand_type = i32 in %arg1 : (!transform.any_op) -> !transform.any_op
+ transform.test_print_remark_at_operand %match_name, "matched op name" : !transform.any_op
+ transform.test_consume_operand %match_name : !transform.any_op
+}
+
+// -----
+
+func.func @by_operand_type_negative_match() {
----------------
pabloantoniom wrote:
Solved, thanks
https://github.com/llvm/llvm-project/pull/67994
More information about the Mlir-commits
mailing list