1// RUN: mlir-opt -transform-interpreter %s -allow-unregistered-dialect -verify-diagnostics --split-input-file | FileCheck %s 2 3// CHECK: func.func @foo() { 4// CHECK: "dummy_op"() : () -> () 5// CHECK: } 6// CHECK-NOT: func.func @bar 7func.func @bar() { 8 "another_op"() : () -> () 9} 10 11module attributes {transform.with_named_sequence} { 12 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) { 13 %0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op 14 transform.structured.replace %0 { 15 builtin.module { 16 func.func @foo() { 17 "dummy_op"() : () -> () 18 } 19 } 20 } : (!transform.any_op) -> !transform.any_op 21 transform.yield 22 } 23} 24 25// ----- 26 27func.func @bar(%arg0: i1) { 28 "another_op"(%arg0) : (i1) -> () 29} 30 31module attributes {transform.with_named_sequence} { 32 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) { 33 %0 = transform.structured.match ops{["another_op"]} in %arg1 : (!transform.any_op) -> !transform.any_op 34 // expected-error @+1 {{expected target without operands}} 35 transform.structured.replace %0 { 36 "dummy_op"() : () -> () 37 } : (!transform.any_op) -> !transform.any_op 38 transform.yield 39 } 40} 41 42// ----- 43 44func.func @bar() { 45 "another_op"() : () -> () 46} 47 48module attributes {transform.with_named_sequence} { 49 transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) { 50 %0 = transform.structured.match ops{["another_op"]} in %arg1 : (!transform.any_op) -> !transform.any_op 51 transform.structured.replace %0 { 52 ^bb0(%a: i1): 53 // expected-error @+1 {{expected replacement without operands}} 54 "dummy_op"(%a) : (i1) -> () 55 } : (!transform.any_op) -> !transform.any_op 56 transform.yield 57 } 58} 59