1// RUN: mlir-opt %s | mlir-opt | FileCheck %s
2
3// CHECK: transform.sequence
4// CHECK: ^{{.+}}(%{{.+}}: !pdl.operation):
5transform.sequence {
6^bb0(%arg0: !pdl.operation):
7  // CHECK: sequence %{{.+}}
8  // CHECK: ^{{.+}}(%{{.+}}: !pdl.operation):
9  sequence %arg0 {
10  ^bb1(%arg1: !pdl.operation):
11  }
12}
13
14// CHECK: transform.with_pdl_patterns
15// CHECK: ^{{.+}}(%[[ARG:.+]]: !pdl.operation):
16transform.with_pdl_patterns {
17^bb0(%arg0: !pdl.operation):
18  // CHECK: sequence %[[ARG]]
19  sequence %arg0 {
20  ^bb1(%arg1: !pdl.operation):
21  }
22}
23
24// CHECK: transform.sequence
25// CHECK: ^{{.+}}(%[[ARG:.+]]: !pdl.operation):
26transform.sequence {
27^bb0(%arg0: !pdl.operation):
28  // CHECK: with_pdl_patterns %[[ARG]]
29  with_pdl_patterns %arg0 {
30  ^bb1(%arg1: !pdl.operation):
31  }
32}
33
34// Using the same value multiple times without consuming it is fine.
35// CHECK: transform.sequence
36// CHECK: %[[V:.+]] = sequence
37// CHECK: sequence %[[V]]
38// CHECK: sequence %[[V]]
39transform.sequence {
40^bb0(%arg0: !pdl.operation):
41  %0 = transform.sequence %arg0 {
42  ^bb1(%arg1: !pdl.operation):
43    yield %arg1 : !pdl.operation
44  } : !pdl.operation
45  transform.sequence %0 {
46  ^bb2(%arg2: !pdl.operation):
47  }
48  transform.sequence %0 {
49  ^bb3(%arg3: !pdl.operation):
50  }
51}
52
53// CHECK: transform.sequence
54// CHECK: foreach
55transform.sequence {
56^bb0(%arg0: !pdl.operation):
57  transform.foreach %arg0 {
58  ^bb1(%arg1: !pdl.operation):
59  }
60}
61