Files
clang-p2996/mlir/test/Dialect/Linalg/transform-op-replace.mlir
Joshua Cao 7d055af14b [mlir][Symbol] Add verification that symbol's parent is a SymbolTable (#80590)
Following the discussion in
https://discourse.llvm.org/t/symboltable-and-symbol-parent-child-relationship/75446,
we should enforce that a symbol's immediate parent is a symbol table.

I changed some tests to pass the verification. In most cases, we can
wrap the func with a module, change the func to another op with regions
i.e. scf.if, or change the expected error message.

---------

Co-authored-by: Mehdi Amini <joker.eph@gmail.com>
2024-02-05 22:59:03 -08:00

59 lines
1.8 KiB
MLIR

// RUN: mlir-opt -transform-interpreter %s -allow-unregistered-dialect -verify-diagnostics --split-input-file | FileCheck %s
// CHECK: func.func @foo() {
// CHECK: "dummy_op"() : () -> ()
// CHECK: }
// CHECK-NOT: func.func @bar
func.func @bar() {
"another_op"() : () -> ()
}
module attributes {transform.with_named_sequence} {
transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
%0 = transform.structured.match ops{["func.func"]} in %arg1 : (!transform.any_op) -> !transform.any_op
transform.structured.replace %0 {
builtin.module {
func.func @foo() {
"dummy_op"() : () -> ()
}
}
} : (!transform.any_op) -> !transform.any_op
transform.yield
}
}
// -----
func.func @bar(%arg0: i1) {
"another_op"(%arg0) : (i1) -> ()
}
module attributes {transform.with_named_sequence} {
transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
%0 = transform.structured.match ops{["another_op"]} in %arg1 : (!transform.any_op) -> !transform.any_op
// expected-error @+1 {{expected target without operands}}
transform.structured.replace %0 {
"dummy_op"() : () -> ()
} : (!transform.any_op) -> !transform.any_op
transform.yield
}
}
// -----
func.func @bar() {
"another_op"() : () -> ()
}
module attributes {transform.with_named_sequence} {
transform.named_sequence @__transform_main(%arg1: !transform.any_op {transform.readonly}) {
%0 = transform.structured.match ops{["another_op"]} in %arg1 : (!transform.any_op) -> !transform.any_op
transform.structured.replace %0 {
^bb0(%a: i1):
// expected-error @+1 {{expected replacement without operands}}
"dummy_op"(%a) : (i1) -> ()
} : (!transform.any_op) -> !transform.any_op
transform.yield
}
}