[Mlir-commits] [mlir] [MLIR][Transform] Add attribute in MatchOp to filter by operand type (PR #67994)
Matthias Springer
llvmlistbot at llvm.org
Thu Nov 9 18:18:00 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() {
----------------
matthias-springer wrote:
A single test case for "match" and "no match" should be sufficient. E.g., add two ops `"test.foo"() : () -> (i32)` and `"test.foo"() : () -> (f32)`. One will be matched, the one other one won't.
https://github.com/llvm/llvm-project/pull/67994
More information about the Mlir-commits
mailing list