70 lines · plain
1// RUN: transform-opt-ch3 %s --transform-interpreter \2// RUN: --allow-unregistered-dialect --split-input-file | FileCheck %s3 4// ****************************** IMPORTANT NOTE ******************************5//6// If you are changing this file, you may also need to change7// mlir/docs/Tutorials/Transform accordingly.8//9// ****************************************************************************10 11func.func private @orig()12func.func private @updated()13 14// CHECK-LABEL: func @test115func.func @test1() {16 // CHECK: call @updated17 call @orig() : () -> ()18 return19}20 21module attributes {transform.with_named_sequence} {22 transform.named_sequence @__transform_main(%arg0: !transform.any_op) {23 %call = transform.structured.match ops{["func.call"]} in %arg0 : (!transform.any_op) -> !transform.op<"func.call">24 // CHECK: transform.my.change_call_target %{{.*}}, "updated" : !transform.op<"func.call">25 transform.my.change_call_target %call, "updated" : !transform.op<"func.call">26 transform.yield27 }28}29 30// -----31 32func.func private @orig()33func.func private @updated()34 35// CHECK-LABEL: func @test236func.func @test2() {37 // CHECK: call @updated38 call @orig() : () -> ()39 return40}41 42module attributes {transform.with_named_sequence} {43 transform.named_sequence @__transform_main(%arg0: !transform.any_op) {44 %call = transform.structured.match ops{["func.call"]} in %arg0 : (!transform.any_op) -> !transform.my.call_op_interface45 // CHECK: transform.my.change_call_target %{{.*}}, "updated" : !transform.my.call_op_interface46 transform.my.change_call_target %call, "updated" : !transform.my.call_op_interface47 transform.yield48 }49}50 51// -----52 53func.func private @orig()54 55// CHECK-LABEL: func @test356func.func @test3() {57 // CHECK: "my.mm4"58 call @orig() : () -> ()59 return60}61 62module attributes {transform.with_named_sequence} {63 transform.named_sequence @__transform_main(%arg0: !transform.any_op) {64 %call = transform.structured.match ops{["func.call"]} in %arg0 : (!transform.any_op) -> !transform.my.call_op_interface65 // CHECK: transform.my.call_to_op %{{.*}} : (!transform.my.call_op_interface) -> !transform.any_op66 transform.my.call_to_op %call : (!transform.my.call_op_interface) -> !transform.any_op67 transform.yield68 }69}70