173
|
1 // RUN: mlir-opt -allow-unregistered-dialect %s | mlir-opt -allow-unregistered-dialect -verify-diagnostics | FileCheck %s
|
150
|
2
|
|
3 // CHECK: %[[I64:.*]] =
|
|
4 %i64 = "foo.op"() : () -> (i64)
|
221
|
5 // CHECK: %[[I32:.*]] =
|
|
6 %i32 = "foo.op"() : () -> (i32)
|
150
|
7 // CHECK: %[[MEMREF:.*]] =
|
|
8 %memref = "foo.op"() : () -> (memref<1xf64>)
|
|
9
|
221
|
10 // CHECK: test.format_literal_op keyword_$. -> :, = <> () []( ) ? + * {
|
|
11 // CHECK-NEXT: } {foo.some_attr}
|
|
12 test.format_literal_op keyword_$. -> :, = <> () []( ) ? + * {
|
|
13 } {foo.some_attr}
|
150
|
14
|
|
15 // CHECK: test.format_attr_op 10
|
|
16 // CHECK-NOT: {attr
|
|
17 test.format_attr_op 10
|
|
18
|
221
|
19 // CHECK: test.format_opt_attr_op_a(10)
|
|
20 // CHECK-NOT: {opt_attr
|
|
21 test.format_opt_attr_op_a(10)
|
|
22 test.format_opt_attr_op_a
|
|
23
|
|
24 // CHECK: test.format_opt_attr_op_b 10
|
173
|
25 // CHECK-NOT: {opt_attr
|
221
|
26 test.format_opt_attr_op_b 10
|
|
27 test.format_opt_attr_op_b
|
|
28
|
|
29 // CHECK: test.format_symbol_name_attr_op @name
|
|
30 // CHECK-NOT: {attr
|
|
31 test.format_symbol_name_attr_op @name
|
|
32
|
|
33 // CHECK: test.format_symbol_name_attr_op @opt_name
|
|
34 // CHECK-NOT: {attr
|
|
35 test.format_symbol_name_attr_op @opt_name
|
|
36 test.format_opt_symbol_name_attr_op
|
173
|
37
|
|
38 // CHECK: test.format_attr_dict_w_keyword attributes {attr = 10 : i64}
|
|
39 test.format_attr_dict_w_keyword attributes {attr = 10 : i64}
|
|
40
|
|
41 // CHECK: test.format_attr_dict_w_keyword attributes {attr = 10 : i64, opt_attr = 10 : i64}
|
|
42 test.format_attr_dict_w_keyword attributes {attr = 10 : i64, opt_attr = 10 : i64}
|
|
43
|
150
|
44 // CHECK: test.format_buildable_type_op %[[I64]]
|
|
45 %ignored = test.format_buildable_type_op %i64
|
|
46
|
173
|
47 //===----------------------------------------------------------------------===//
|
221
|
48 // Format regions
|
|
49 //===----------------------------------------------------------------------===//
|
|
50
|
|
51 // CHECK: test.format_region_a_op {
|
|
52 // CHECK-NEXT: test.return
|
|
53 test.format_region_a_op {
|
|
54 "test.return"() : () -> ()
|
|
55 }
|
|
56
|
|
57 // CHECK: test.format_region_b_op {
|
|
58 // CHECK-NEXT: test.return
|
|
59 test.format_region_b_op {
|
|
60 "test.return"() : () -> ()
|
|
61 }
|
|
62
|
|
63 // CHECK: test.format_region_c_op region {
|
|
64 // CHECK-NEXT: test.return
|
|
65 test.format_region_c_op region {
|
|
66 "test.return"() : () -> ()
|
|
67 }
|
|
68 // CHECK: test.format_region_c_op
|
|
69 // CHECK-NOT: region {
|
|
70 test.format_region_c_op
|
|
71
|
|
72 // CHECK: test.format_variadic_region_a_op {
|
|
73 // CHECK-NEXT: test.return
|
|
74 // CHECK-NEXT: }, {
|
|
75 // CHECK-NEXT: test.return
|
|
76 // CHECK-NEXT: }
|
|
77 test.format_variadic_region_a_op {
|
|
78 "test.return"() : () -> ()
|
|
79 }, {
|
|
80 "test.return"() : () -> ()
|
|
81 }
|
|
82 // CHECK: test.format_variadic_region_b_op {
|
|
83 // CHECK-NEXT: test.return
|
|
84 // CHECK-NEXT: }, {
|
|
85 // CHECK-NEXT: test.return
|
|
86 // CHECK-NEXT: } found_regions
|
|
87 test.format_variadic_region_b_op {
|
|
88 "test.return"() : () -> ()
|
|
89 }, {
|
|
90 "test.return"() : () -> ()
|
|
91 } found_regions
|
|
92 // CHECK: test.format_variadic_region_b_op
|
|
93 // CHECK-NOT: {
|
|
94 // CHECK-NOT: found_regions
|
|
95 test.format_variadic_region_b_op
|
|
96
|
|
97 // CHECK: test.format_implicit_terminator_region_a_op {
|
|
98 // CHECK-NEXT: }
|
|
99 test.format_implicit_terminator_region_a_op {
|
|
100 "test.return"() : () -> ()
|
|
101 }
|
|
102 // CHECK: test.format_implicit_terminator_region_a_op {
|
|
103 // CHECK-NEXT: test.return"() {foo.attr
|
|
104 test.format_implicit_terminator_region_a_op {
|
|
105 "test.return"() {foo.attr} : () -> ()
|
|
106 }
|
|
107 // CHECK: test.format_implicit_terminator_region_a_op {
|
|
108 // CHECK-NEXT: test.return"(%[[I64]]) : (i64)
|
|
109 test.format_implicit_terminator_region_a_op {
|
|
110 "test.return"(%i64) : (i64) -> ()
|
|
111 }
|
|
112
|
|
113 //===----------------------------------------------------------------------===//
|
173
|
114 // Format results
|
|
115 //===----------------------------------------------------------------------===//
|
|
116
|
150
|
117 // CHECK: test.format_result_a_op memref<1xf64>
|
|
118 %ignored_a:2 = test.format_result_a_op memref<1xf64>
|
|
119
|
|
120 // CHECK: test.format_result_b_op i64, memref<1xf64>
|
|
121 %ignored_b:2 = test.format_result_b_op i64, memref<1xf64>
|
|
122
|
|
123 // CHECK: test.format_result_c_op (i64) -> memref<1xf64>
|
|
124 %ignored_c:2 = test.format_result_c_op (i64) -> memref<1xf64>
|
|
125
|
221
|
126 // CHECK: test.format_variadic_result : i64, i64, i64
|
|
127 %ignored_v:3 = test.format_variadic_result : i64, i64, i64
|
|
128
|
|
129 // CHECK: test.format_multiple_variadic_results : (i64, i64, i64), (i32, i32)
|
|
130 %ignored_mv:5 = test.format_multiple_variadic_results : (i64, i64, i64), (i32, i32)
|
|
131
|
173
|
132 //===----------------------------------------------------------------------===//
|
|
133 // Format operands
|
|
134 //===----------------------------------------------------------------------===//
|
|
135
|
150
|
136 // CHECK: test.format_operand_a_op %[[I64]], %[[MEMREF]] : i64, memref<1xf64>
|
|
137 test.format_operand_a_op %i64, %memref : i64, memref<1xf64>
|
|
138
|
|
139 // CHECK: test.format_operand_b_op %[[I64]], %[[MEMREF]] : memref<1xf64>
|
|
140 test.format_operand_b_op %i64, %memref : memref<1xf64>
|
|
141
|
|
142 // CHECK: test.format_operand_c_op %[[I64]], %[[MEMREF]] : i64, memref<1xf64>
|
|
143 test.format_operand_c_op %i64, %memref : i64, memref<1xf64>
|
|
144
|
|
145 // CHECK: test.format_operand_d_op %[[I64]], %[[MEMREF]] : memref<1xf64>
|
|
146 test.format_operand_d_op %i64, %memref : memref<1xf64>
|
|
147
|
|
148 // CHECK: test.format_operand_e_op %[[I64]], %[[MEMREF]] : i64, memref<1xf64>
|
|
149 test.format_operand_e_op %i64, %memref : i64, memref<1xf64>
|
173
|
150
|
221
|
151 // CHECK: test.format_variadic_operand %[[I64]], %[[I64]], %[[I64]] : i64, i64, i64
|
|
152 test.format_variadic_operand %i64, %i64, %i64 : i64, i64, i64
|
|
153
|
|
154 // CHECK: test.format_multiple_variadic_operands (%[[I64]], %[[I64]], %[[I64]]), (%[[I64]], %[[I32]] : i64, i32)
|
|
155 test.format_multiple_variadic_operands (%i64, %i64, %i64), (%i64, %i32 : i64, i32)
|
|
156
|
173
|
157 //===----------------------------------------------------------------------===//
|
|
158 // Format successors
|
|
159 //===----------------------------------------------------------------------===//
|
|
160
|
|
161 "foo.successor_test_region"() ( {
|
|
162 ^bb0:
|
|
163 // CHECK: test.format_successor_a_op ^bb1 {attr}
|
|
164 test.format_successor_a_op ^bb1 {attr}
|
|
165
|
|
166 ^bb1:
|
|
167 // CHECK: test.format_successor_a_op ^bb1, ^bb2 {attr}
|
|
168 test.format_successor_a_op ^bb1, ^bb2 {attr}
|
|
169
|
|
170 ^bb2:
|
|
171 // CHECK: test.format_successor_a_op {attr}
|
|
172 test.format_successor_a_op {attr}
|
|
173
|
|
174 }) { arg_names = ["i", "j", "k"] } : () -> ()
|
|
175
|
|
176 //===----------------------------------------------------------------------===//
|
221
|
177 // Format optional attributes
|
|
178 //===----------------------------------------------------------------------===//
|
|
179
|
|
180 // CHECK: test.format_optional_unit_attribute is_optional
|
|
181 test.format_optional_unit_attribute is_optional
|
|
182
|
|
183 // CHECK: test.format_optional_unit_attribute
|
|
184 // CHECK-NOT: is_optional
|
|
185 test.format_optional_unit_attribute
|
|
186
|
|
187 // CHECK: test.format_optional_unit_attribute_no_elide unit
|
|
188 test.format_optional_unit_attribute_no_elide unit
|
|
189
|
|
190 // CHECK: test.format_optional_enum_attr case5
|
|
191 test.format_optional_enum_attr case5
|
|
192
|
|
193 // CHECK: test.format_optional_enum_attr
|
|
194 // CHECK-NOT: "case5"
|
|
195 test.format_optional_enum_attr
|
|
196
|
|
197 //===----------------------------------------------------------------------===//
|
173
|
198 // Format optional operands and results
|
|
199 //===----------------------------------------------------------------------===//
|
|
200
|
|
201 // CHECK: test.format_optional_operand_result_a_op(%[[I64]] : i64) : i64
|
|
202 test.format_optional_operand_result_a_op(%i64 : i64) : i64
|
|
203
|
|
204 // CHECK: test.format_optional_operand_result_a_op( : ) : i64
|
|
205 test.format_optional_operand_result_a_op( : ) : i64
|
|
206
|
|
207 // CHECK: test.format_optional_operand_result_a_op(%[[I64]] : i64) :
|
|
208 // CHECK-NOT: i64
|
|
209 test.format_optional_operand_result_a_op(%i64 : i64) :
|
|
210
|
|
211 // CHECK: test.format_optional_operand_result_a_op(%[[I64]] : i64) : [%[[I64]], %[[I64]]]
|
|
212 test.format_optional_operand_result_a_op(%i64 : i64) : [%i64, %i64]
|
|
213
|
|
214 // CHECK: test.format_optional_operand_result_b_op(%[[I64]] : i64) : i64
|
|
215 test.format_optional_operand_result_b_op(%i64 : i64) : i64
|
|
216
|
|
217 // CHECK: test.format_optional_operand_result_b_op : i64
|
|
218 test.format_optional_operand_result_b_op( : ) : i64
|
|
219
|
|
220 // CHECK: test.format_optional_operand_result_b_op : i64
|
|
221 test.format_optional_operand_result_b_op : i64
|
221
|
222
|
|
223 //===----------------------------------------------------------------------===//
|
|
224 // Format optional results
|
|
225 //===----------------------------------------------------------------------===//
|
|
226
|
|
227 // CHECK: test.format_optional_result_a_op
|
|
228 test.format_optional_result_a_op
|
|
229
|
|
230 // CHECK: test.format_optional_result_a_op : i64 -> i64, i64
|
|
231 test.format_optional_result_a_op : i64 -> i64, i64
|
|
232
|
|
233 // CHECK: test.format_optional_result_b_op
|
|
234 test.format_optional_result_b_op
|
|
235
|
|
236 // CHECK: test.format_optional_result_b_op : i64 -> i64, i64
|
|
237 test.format_optional_result_b_op : i64 -> i64, i64
|
|
238
|
|
239 // CHECK: test.format_optional_result_c_op : (i64) -> (i64, i64)
|
|
240 test.format_optional_result_c_op : (i64) -> (i64, i64)
|
|
241
|
|
242 //===----------------------------------------------------------------------===//
|
|
243 // Format optional with else
|
|
244 //===----------------------------------------------------------------------===//
|
|
245
|
|
246 // CHECK: test.format_optional_else then
|
|
247 test.format_optional_else then
|
|
248
|
|
249 // CHECK: test.format_optional_else else
|
|
250 test.format_optional_else else
|
|
251
|
|
252 //===----------------------------------------------------------------------===//
|
|
253 // Format custom directives
|
|
254 //===----------------------------------------------------------------------===//
|
|
255
|
|
256 // CHECK: test.format_custom_directive_operands %[[I64]], %[[I64]] -> (%[[I64]])
|
|
257 test.format_custom_directive_operands %i64, %i64 -> (%i64)
|
|
258
|
|
259 // CHECK: test.format_custom_directive_operands %[[I64]] -> (%[[I64]])
|
|
260 test.format_custom_directive_operands %i64 -> (%i64)
|
|
261
|
|
262 // CHECK: test.format_custom_directive_operands_and_types %[[I64]], %[[I64]] -> (%[[I64]]) : i64, i64 -> (i64)
|
|
263 test.format_custom_directive_operands_and_types %i64, %i64 -> (%i64) : i64, i64 -> (i64)
|
|
264
|
|
265 // CHECK: test.format_custom_directive_operands_and_types %[[I64]] -> (%[[I64]]) : i64 -> (i64)
|
|
266 test.format_custom_directive_operands_and_types %i64 -> (%i64) : i64 -> (i64)
|
|
267
|
|
268 // CHECK: test.format_custom_directive_attributes 54 : i64
|
|
269 test.format_custom_directive_attributes 54 : i64
|
|
270
|
|
271 // CHECK: test.format_custom_directive_attributes 54 : i64, 46 : i64
|
|
272 test.format_custom_directive_attributes 54 : i64, 46 : i64
|
|
273
|
|
274 // CHECK: test.format_custom_directive_regions {
|
|
275 // CHECK-NEXT: test.return
|
|
276 // CHECK-NEXT: }
|
|
277 test.format_custom_directive_regions {
|
|
278 "test.return"() : () -> ()
|
|
279 }
|
|
280
|
|
281 // CHECK: test.format_custom_directive_regions {
|
|
282 // CHECK-NEXT: test.return
|
|
283 // CHECK-NEXT: }, {
|
|
284 // CHECK-NEXT: test.return
|
|
285 // CHECK-NEXT: }
|
|
286 test.format_custom_directive_regions {
|
|
287 "test.return"() : () -> ()
|
|
288 }, {
|
|
289 "test.return"() : () -> ()
|
|
290 }
|
|
291
|
|
292 // CHECK: test.format_custom_directive_results : i64, i64 -> (i64)
|
|
293 test.format_custom_directive_results : i64, i64 -> (i64)
|
|
294
|
|
295 // CHECK: test.format_custom_directive_results : i64 -> (i64)
|
|
296 test.format_custom_directive_results : i64 -> (i64)
|
|
297
|
|
298 // CHECK: test.format_custom_directive_results_with_type_refs : i64, i64 -> (i64) type_refs_capture : i64, i64 -> (i64)
|
|
299 test.format_custom_directive_results_with_type_refs : i64, i64 -> (i64) type_refs_capture : i64, i64 -> (i64)
|
|
300
|
|
301 // CHECK: test.format_custom_directive_results_with_type_refs : i64 -> (i64) type_refs_capture : i64 -> (i64)
|
|
302 test.format_custom_directive_results_with_type_refs : i64 -> (i64) type_refs_capture : i64 -> (i64)
|
|
303
|
|
304 // CHECK: test.format_custom_directive_with_optional_operand_ref %[[I64]] : 1
|
|
305 test.format_custom_directive_with_optional_operand_ref %i64 : 1
|
|
306
|
|
307 // CHECK: test.format_custom_directive_with_optional_operand_ref : 0
|
|
308 test.format_custom_directive_with_optional_operand_ref : 0
|
|
309
|
|
310 func @foo() {
|
|
311 // CHECK: test.format_custom_directive_successors ^bb1, ^bb2
|
|
312 test.format_custom_directive_successors ^bb1, ^bb2
|
|
313
|
|
314 ^bb1:
|
|
315 // CHECK: test.format_custom_directive_successors ^bb2
|
|
316 test.format_custom_directive_successors ^bb2
|
|
317
|
|
318 ^bb2:
|
|
319 return
|
|
320 }
|
|
321
|
|
322 //===----------------------------------------------------------------------===//
|
|
323 // Format trait type inference
|
|
324 //===----------------------------------------------------------------------===//
|
|
325
|
|
326 // CHECK: test.format_infer_variadic_type_from_non_variadic %[[I64]], %[[I64]] : i64
|
|
327 test.format_infer_variadic_type_from_non_variadic %i64, %i64 : i64
|
|
328
|
|
329 //===----------------------------------------------------------------------===//
|
|
330 // AllTypesMatch type inference
|
|
331 //===----------------------------------------------------------------------===//
|
|
332
|
|
333 // CHECK: test.format_all_types_match_var %[[I64]], %[[I64]] : i64
|
|
334 %ignored_res1 = test.format_all_types_match_var %i64, %i64 : i64
|
|
335
|
|
336 // CHECK: test.format_all_types_match_attr 1 : i64, %[[I64]]
|
|
337 %ignored_res2 = test.format_all_types_match_attr 1 : i64, %i64
|
|
338
|
|
339 //===----------------------------------------------------------------------===//
|
|
340 // TypesMatchWith type inference
|
|
341 //===----------------------------------------------------------------------===//
|
|
342
|
|
343 // CHECK: test.format_types_match_var %[[I64]] : i64
|
|
344 %ignored_res3 = test.format_types_match_var %i64 : i64
|
|
345
|
|
346 // CHECK: test.format_types_match_variadic %[[I64]], %[[I64]], %[[I64]] : i64, i64, i64
|
|
347 %ignored_res4:3 = test.format_types_match_variadic %i64, %i64, %i64 : i64, i64, i64
|
|
348
|
|
349 // CHECK: test.format_types_match_attr 1 : i64
|
|
350 %ignored_res5 = test.format_types_match_attr 1 : i64
|