xref: /llvm-project/mlir/test/Dialect/Transform/multi-arg-top-level-values.mlir (revision 5468f8841353cd56350a6ebe6898d2563e5c34b0)
1// RUN: mlir-opt %s --pass-pipeline='builtin.module(transform-interpreter{\
2// RUN:     debug-bind-trailing-args=^test.some_returning_op,^test.some_other_returning_op})' \
3// RUN:             --split-input-file --verify-diagnostics
4
5// Note that diagnostic checker will merge two diagnostics with the same message
6// at the same location, so only check the remark once.
7//
8// expected-remark @below {{first extra}}
9// expected-note @below {{value handle points to an op result #0}}
10// expected-note @below {{value handle points to an op result #1}}
11%0:2 = "test.some_returning_op"() : () -> (i32, i64)
12
13// expected-remark @below {{first extra}}
14// expected-note @below {{value handle points to an op result #0}}
15%1 = "test.some_returning_op"() : () -> index
16
17// Note that diagnostic checker will merge two diagnostics with the same message
18// at the same location, so only check the remark once.
19//
20// expected-remark @below {{second extra}}
21// expected-note @below {{value handle points to an op result #0}}
22// expected-note @below {{value handle points to an op result #1}}
23%2:2 = "test.some_other_returning_op"() : () -> (f32, f64)
24
25module attributes {transform.with_named_sequence} {
26  transform.named_sequence @__transform_main(
27      %arg0: !transform.any_op, %arg1: !transform.any_value,
28      %arg2: !transform.any_value) {
29    transform.debug.emit_remark_at %arg1, "first extra" : !transform.any_value
30    transform.debug.emit_remark_at %arg2, "second extra" : !transform.any_value
31    transform.yield
32  }
33}
34
35// -----
36
37%0:2 = "test.some_returning_op"() : () -> (i32, i64)
38%1 = "test.some_returning_op"() : () -> index
39
40module attributes {transform.with_named_sequence} {
41  transform.named_sequence @__transform_main(
42      // expected-error @below {{wrong kind of value provided for top-level operation handle}}
43      %arg0: !transform.any_op, %arg1: !transform.any_op, %arg2: !transform.any_value) {
44    transform.yield
45  }
46}
47
48// -----
49
50module attributes {transform.with_named_sequence} {
51  // expected-error @below {{operation expects 1 extra value bindings, but 2 were provided to the interpreter}}
52  transform.named_sequence @__transform_main(%arg0: !transform.any_op, %arg1: !transform.any_value) {
53    transform.yield
54  }
55}
56