173
|
1 // RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics
|
150
|
2
|
|
3 // Check different error cases.
|
|
4 // -----
|
|
5
|
|
6 func @illegaltype(i) // expected-error {{expected non-function type}}
|
|
7
|
|
8 // -----
|
|
9
|
|
10 func @illegaltype() {
|
|
11 %0 = constant dense<0> : <vector 4 x f32> : vector<4 x f32> // expected-error {{expected non-function type}}
|
|
12 }
|
|
13
|
|
14 // -----
|
|
15
|
|
16 func @nestedtensor(tensor<tensor<i8>>) -> () // expected-error {{invalid tensor element type}}
|
|
17
|
|
18 // -----
|
|
19
|
|
20 func @indexvector(vector<4 x index>) -> () // expected-error {{vector elements must be int or float type}}
|
|
21
|
|
22 // -----
|
|
23
|
|
24 func @indexmemref(memref<? x index>) -> () // expected-error {{invalid memref element type}}
|
|
25
|
|
26 // -----
|
|
27 // Test no map in memref type.
|
|
28 func @memrefs(memref<2x4xi8, >) // expected-error {{expected list element}}
|
|
29
|
|
30 // -----
|
|
31 // Test non-existent map in memref type.
|
|
32 func @memrefs(memref<2x4xi8, #map7>) // expected-error {{undefined symbol alias id 'map7'}}
|
|
33
|
|
34 // -----
|
|
35 // Test non affine map in memref type.
|
|
36 func @memrefs(memref<2x4xi8, i8>) // expected-error {{expected affine map in memref type}}
|
|
37
|
|
38 // -----
|
|
39 // Test non-existent map in map composition of memref type.
|
|
40 #map0 = affine_map<(d0, d1) -> (d0, d1)>
|
|
41
|
|
42 func @memrefs(memref<2x4xi8, #map0, #map8>) // expected-error {{undefined symbol alias id 'map8'}}
|
|
43
|
|
44 // -----
|
|
45 // Test multiple memory space error.
|
|
46 #map0 = affine_map<(d0, d1) -> (d0, d1)>
|
|
47 func @memrefs(memref<2x4xi8, #map0, 1, 2>) // expected-error {{multiple memory spaces specified in memref type}}
|
|
48
|
|
49 // -----
|
|
50 // Test affine map after memory space.
|
|
51 #map0 = affine_map<(d0, d1) -> (d0, d1)>
|
|
52 #map1 = affine_map<(d0, d1) -> (d0, d1)>
|
|
53
|
|
54 func @memrefs(memref<2x4xi8, #map0, 1, #map1>) // expected-error {{expected memory space to be last in memref type}}
|
|
55
|
|
56 // -----
|
|
57 // Test dimension mismatch between memref and layout map.
|
|
58 // The error must be emitted even for the trivial identity layout maps that are
|
|
59 // dropped in type creation.
|
|
60 #map0 = affine_map<(d0, d1) -> (d0, d1)>
|
|
61 func @memrefs(memref<42xi8, #map0>) // expected-error {{memref affine map dimension mismatch}}
|
|
62
|
|
63 // -----
|
|
64
|
|
65 #map0 = affine_map<(d0, d1) -> (d0, d1)>
|
|
66 #map1 = affine_map<(d0) -> (d0)>
|
|
67 func @memrefs(memref<42x42xi8, #map0, #map1>) // expected-error {{memref affine map dimension mismatch}}
|
|
68
|
|
69 // -----
|
|
70
|
|
71 func @memref_space_after_strides(memref<42x42xi8, 0, offset: ?, strides: [?, ?]>) // expected-error {{expected memory space to be last in memref type}}
|
|
72
|
|
73 // -----
|
|
74
|
|
75 func @memref_stride_missing_colon(memref<42x42xi8, offset ?, strides: [?, ?]>) // expected-error {{expected colon after `offset` keyword}}
|
|
76
|
|
77 // -----
|
|
78
|
|
79 func @memref_stride_invalid_offset(memref<42x42xi8, offset: [], strides: [?, ?]>) // expected-error {{invalid offset}}
|
|
80
|
|
81 // -----
|
|
82
|
|
83 func @memref_stride_missing_strides(memref<42x42xi8, offset: 0 [?, ?]>) // expected-error {{expected comma after offset value}}
|
|
84
|
|
85 // -----
|
|
86
|
|
87 func @memref_stride_missing_strides(memref<42x42xi8, offset: 0, [?, ?]>) // expected-error {{expected `strides` keyword after offset specification}}
|
|
88
|
|
89 // -----
|
|
90
|
|
91 func @memref_stride_missing_colon_2(memref<42x42xi8, offset: 0, strides [?, ?]>) // expected-error {{expected colon after `strides` keyword}}
|
|
92
|
|
93 // -----
|
|
94
|
|
95 func @memref_stride_invalid_strides(memref<42x42xi8, offset: 0, strides: ()>) // expected-error {{invalid braces-enclosed stride list}}
|
|
96
|
|
97 // -----
|
|
98
|
|
99 func @memref_zero_stride(memref<42x42xi8, offset: ?, strides: [0, ?]>) // expected-error {{invalid memref stride}}
|
|
100
|
|
101 // -----
|
|
102
|
|
103 func @bad_branch() {
|
|
104 ^bb12:
|
|
105 br ^missing // expected-error {{reference to an undefined block}}
|
|
106 }
|
|
107
|
|
108 // -----
|
|
109
|
|
110 func @block_redef() {
|
|
111 ^bb42:
|
|
112 return
|
|
113 ^bb42: // expected-error {{redefinition of block '^bb42'}}
|
|
114 return
|
|
115 }
|
|
116
|
|
117 // -----
|
|
118
|
|
119 func @no_terminator() { // expected-error {{block with no terminator}}
|
|
120 ^bb40:
|
|
121 return
|
|
122 ^bb41:
|
|
123 ^bb42:
|
|
124 return
|
|
125 }
|
|
126
|
|
127 // -----
|
|
128
|
|
129 func @block_no_rparen() {
|
|
130 ^bb42 (%bb42 : i32: // expected-error {{expected ')' to end argument list}}
|
|
131 return
|
|
132 }
|
|
133
|
|
134 // -----
|
|
135
|
|
136 func @block_arg_no_ssaid() {
|
|
137 ^bb42 (i32): // expected-error {{expected SSA operand}}
|
|
138 return
|
|
139 }
|
|
140
|
|
141 // -----
|
|
142
|
|
143 func @block_arg_no_type() {
|
|
144 ^bb42 (%0): // expected-error {{expected ':' and type for SSA operand}}
|
|
145 return
|
|
146 }
|
|
147
|
|
148 // -----
|
|
149
|
|
150 func @block_arg_no_close_paren() {
|
|
151 ^bb42:
|
173
|
152 br ^bb2( // expected-error@+1 {{expected ':'}}
|
150
|
153 return
|
|
154 }
|
|
155
|
|
156 // -----
|
|
157
|
|
158 func @block_first_has_predecessor() {
|
|
159 // expected-error@-1 {{entry block of region may not have predecessors}}
|
|
160 ^bb42:
|
|
161 br ^bb43
|
|
162 ^bb43:
|
|
163 br ^bb42
|
|
164 }
|
|
165
|
|
166 // -----
|
|
167
|
|
168 func @no_return() {
|
|
169 %x = constant 0 : i32 // expected-error {{block with no terminator}}
|
|
170 }
|
|
171
|
|
172 // -----
|
|
173
|
|
174 " // expected-error {{expected}}
|
|
175 "
|
|
176
|
|
177 // -----
|
|
178
|
|
179 " // expected-error {{expected}}
|
|
180
|
|
181 // -----
|
|
182
|
|
183 func @bad_op_type() {
|
|
184 ^bb40:
|
|
185 "foo"() : i32 // expected-error {{expected function type}}
|
|
186 return
|
|
187 }
|
|
188 // -----
|
|
189
|
|
190 func @no_terminator() {
|
|
191 ^bb40:
|
|
192 "foo"() : ()->()
|
|
193 ""() : ()->() // expected-error {{empty operation name is invalid}}
|
|
194 return
|
|
195 }
|
|
196
|
|
197 // -----
|
|
198
|
|
199 func @illegaltype(i0) // expected-error {{invalid integer width}}
|
|
200
|
|
201 // -----
|
|
202
|
|
203 func @malformed_for_percent() {
|
|
204 affine.for i = 1 to 10 { // expected-error {{expected SSA operand}}
|
|
205
|
|
206 // -----
|
|
207
|
|
208 func @malformed_for_equal() {
|
|
209 affine.for %i 1 to 10 { // expected-error {{expected '='}}
|
|
210
|
|
211 // -----
|
|
212
|
|
213 func @malformed_for_to() {
|
|
214 affine.for %i = 1 too 10 { // expected-error {{expected 'to' between bounds}}
|
|
215 }
|
|
216 }
|
|
217
|
|
218 // -----
|
|
219
|
|
220 func @incomplete_for() {
|
|
221 affine.for %i = 1 to 10 step 2
|
|
222 } // expected-error {{expected '{' to begin a region}}
|
|
223
|
|
224 // -----
|
|
225
|
|
226 #map0 = affine_map<(d0) -> (d0 floordiv 4)>
|
|
227
|
|
228 func @reference_to_iv_in_bound() {
|
|
229 // expected-error@+2 {{region entry argument '%i0' is already in use}}
|
|
230 // expected-note@+1 {{previously referenced here}}
|
|
231 affine.for %i0 = #map0(%i0) to 10 {
|
|
232 }
|
|
233 }
|
|
234
|
|
235 // -----
|
|
236
|
|
237 func @nonconstant_step(%1 : i32) {
|
|
238 affine.for %2 = 1 to 5 step %1 { // expected-error {{expected non-function type}}
|
|
239
|
|
240 // -----
|
|
241
|
|
242 func @for_negative_stride() {
|
|
243 affine.for %i = 1 to 10 step -1
|
|
244 } // expected-error@-1 {{expected step to be representable as a positive signed integer}}
|
|
245
|
|
246 // -----
|
|
247
|
|
248 func @non_operation() {
|
|
249 asd // expected-error {{custom op 'asd' is unknown}}
|
|
250 }
|
|
251
|
|
252 // -----
|
|
253
|
|
254 func @invalid_if_conditional2() {
|
|
255 affine.for %i = 1 to 10 {
|
|
256 affine.if affine_set<(i)[N] : (i >= )> // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}}
|
|
257 }
|
|
258 }
|
|
259
|
|
260 // -----
|
|
261
|
|
262 func @invalid_if_conditional3() {
|
|
263 affine.for %i = 1 to 10 {
|
|
264 affine.if affine_set<(i)[N] : (i == 1)> // expected-error {{expected '0' after '=='}}
|
|
265 }
|
|
266 }
|
|
267
|
|
268 // -----
|
|
269
|
|
270 func @invalid_if_conditional4() {
|
|
271 affine.for %i = 1 to 10 {
|
|
272 affine.if affine_set<(i)[N] : (i >= 2)> // expected-error {{expected '0' after '>='}}
|
|
273 }
|
|
274 }
|
|
275
|
|
276 // -----
|
|
277
|
|
278 func @invalid_if_conditional5() {
|
|
279 affine.for %i = 1 to 10 {
|
|
280 affine.if affine_set<(i)[N] : (i <= 0)> // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}}
|
|
281 }
|
|
282 }
|
|
283
|
|
284 // -----
|
|
285
|
|
286 func @invalid_if_conditional6() {
|
|
287 affine.for %i = 1 to 10 {
|
|
288 affine.if affine_set<(i) : (i)> // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}}
|
|
289 }
|
|
290 }
|
|
291
|
|
292 // -----
|
|
293 // TODO (support affine.if (1)?
|
|
294 func @invalid_if_conditional7() {
|
|
295 affine.for %i = 1 to 10 {
|
|
296 affine.if affine_set<(i) : (1)> // expected-error {{expected '== 0' or '>= 0' at end of affine constraint}}
|
|
297 }
|
|
298 }
|
|
299
|
|
300 // -----
|
|
301
|
|
302 #map = affine_map<(d0) -> (% // expected-error {{invalid SSA name}}
|
|
303
|
|
304 // -----
|
|
305
|
|
306 func @test() {
|
|
307 ^bb40:
|
|
308 %1 = "foo"() : (i32)->i64 // expected-error {{expected 0 operand types but had 1}}
|
|
309 return
|
|
310 }
|
|
311
|
|
312 // -----
|
|
313
|
|
314 func @redef() {
|
|
315 ^bb42:
|
|
316 %x = "xxx"(){index = 0} : ()->i32 // expected-note {{previously defined here}}
|
|
317 %x = "xxx"(){index = 0} : ()->i32 // expected-error {{redefinition of SSA value '%x'}}
|
|
318 return
|
|
319 }
|
|
320
|
|
321 // -----
|
|
322
|
|
323 func @undef() {
|
|
324 ^bb42:
|
|
325 %x = "xxx"(%y) : (i32)->i32 // expected-error {{use of undeclared SSA value}}
|
|
326 return
|
|
327 }
|
|
328
|
|
329 // -----
|
|
330
|
|
331 func @malformed_type(%a : intt) { // expected-error {{expected non-function type}}
|
|
332 }
|
|
333
|
|
334 // -----
|
|
335
|
|
336 func @resulterror() -> i32 {
|
|
337 ^bb42:
|
|
338 return // expected-error {{'std.return' op has 0 operands, but enclosing function returns 1}}
|
|
339 }
|
|
340
|
|
341 // -----
|
|
342
|
|
343 func @func_resulterror() -> i32 {
|
|
344 return // expected-error {{'std.return' op has 0 operands, but enclosing function returns 1}}
|
|
345 }
|
|
346
|
|
347 // -----
|
|
348
|
|
349 func @argError() {
|
|
350 ^bb1(%a: i64): // expected-note {{previously defined here}}
|
|
351 br ^bb2
|
|
352 ^bb2(%a: i64): // expected-error{{redefinition of SSA value '%a'}}
|
|
353 return
|
|
354 }
|
|
355
|
|
356 // -----
|
|
357
|
|
358 func @br_mismatch() {
|
|
359 ^bb0:
|
|
360 %0:2 = "foo"() : () -> (i1, i17)
|
|
361 // expected-error @+1 {{branch has 2 operands for successor #0, but target block has 1}}
|
|
362 br ^bb1(%0#1, %0#0 : i17, i1)
|
|
363
|
|
364 ^bb1(%x: i17):
|
|
365 return
|
|
366 }
|
|
367
|
|
368 // -----
|
|
369
|
|
370 func @succ_arg_type_mismatch() {
|
|
371 ^bb0:
|
|
372 %0 = "getBool"() : () -> i1
|
|
373 // expected-error @+1 {{type mismatch for bb argument #0 of successor #0}}
|
|
374 br ^bb1(%0 : i1)
|
|
375
|
|
376 ^bb1(%x: i32):
|
|
377 return
|
|
378 }
|
|
379
|
|
380
|
|
381 // -----
|
|
382
|
|
383 // Test no nested vector.
|
|
384 func @vectors(vector<1 x vector<1xi32>>, vector<2x4xf32>)
|
|
385 // expected-error@-1 {{vector elements must be int or float type}}
|
|
386
|
|
387 // -----
|
|
388
|
|
389 func @condbr_notbool() {
|
|
390 ^bb0:
|
|
391 %a = "foo"() : () -> i32 // expected-note {{prior use here}}
|
|
392 cond_br %a, ^bb0, ^bb0 // expected-error {{use of value '%a' expects different type than prior uses: 'i1' vs 'i32'}}
|
|
393 }
|
|
394
|
|
395 // -----
|
|
396
|
|
397 func @condbr_badtype() {
|
|
398 ^bb0:
|
|
399 %c = "foo"() : () -> i1
|
|
400 %a = "foo"() : () -> i32
|
|
401 cond_br %c, ^bb0(%a, %a : i32, ^bb0) // expected-error {{expected non-function type}}
|
|
402 }
|
|
403
|
|
404 // -----
|
|
405
|
|
406 func @condbr_a_bb_is_not_a_type() {
|
|
407 ^bb0:
|
|
408 %c = "foo"() : () -> i1
|
|
409 %a = "foo"() : () -> i32
|
|
410 cond_br %c, ^bb0(%a, %a : i32, i32), i32 // expected-error {{expected block name}}
|
|
411 }
|
|
412
|
|
413 // -----
|
|
414
|
|
415 func @successors_in_non_terminator(%a : i32, %b : i32) {
|
|
416 %c = "std.addi"(%a, %b)[^bb1] : () -> () // expected-error {{successors in non-terminator}}
|
|
417 ^bb1:
|
|
418 return
|
|
419 }
|
|
420
|
|
421 // -----
|
|
422
|
|
423 func @undef() {
|
|
424 ^bb0:
|
|
425 %x = "xxx"(%y) : (i32)->i32 // expected-error {{use of undeclared SSA value name}}
|
|
426 return
|
|
427 }
|
|
428
|
|
429 // -----
|
|
430
|
|
431 func @undef() {
|
|
432 %x = "xxx"(%y) : (i32)->i32 // expected-error {{use of undeclared SSA value name}}
|
|
433 return
|
|
434 }
|
|
435
|
|
436 // -----
|
|
437
|
|
438 func @duplicate_induction_var() {
|
|
439 affine.for %i = 1 to 10 { // expected-note {{previously referenced here}}
|
|
440 affine.for %i = 1 to 10 { // expected-error {{region entry argument '%i' is already in use}}
|
|
441 }
|
|
442 }
|
|
443 return
|
|
444 }
|
|
445
|
|
446 // -----
|
|
447
|
|
448 func @name_scope_failure() {
|
|
449 affine.for %i = 1 to 10 {
|
|
450 }
|
|
451 "xxx"(%i) : (index)->() // expected-error {{use of undeclared SSA value name}}
|
|
452 return
|
|
453 }
|
|
454
|
|
455 // -----
|
|
456
|
|
457 func @dominance_failure() {
|
|
458 ^bb0:
|
|
459 "foo"(%x) : (i32) -> () // expected-error {{operand #0 does not dominate this use}}
|
|
460 br ^bb1
|
|
461 ^bb1:
|
|
462 %x = "bar"() : () -> i32 // expected-note {{operand defined here}}
|
|
463 return
|
|
464 }
|
|
465
|
|
466 // -----
|
|
467
|
|
468 func @return_type_mismatch() -> i32 {
|
|
469 %0 = "foo"() : ()->f32
|
|
470 return %0 : f32 // expected-error {{type of return operand 0 ('f32') doesn't match function result type ('i32')}}
|
|
471 }
|
|
472
|
|
473 // -----
|
|
474
|
|
475 func @return_inside_loop() {
|
|
476 affine.for %i = 1 to 100 {
|
|
477 // expected-error@-1 {{op expects regions to end with 'affine.terminator', found 'std.return'}}
|
|
478 // expected-note@-2 {{in custom textual format, the absence of terminator implies}}
|
|
479 return
|
|
480 }
|
|
481 return
|
|
482 }
|
|
483
|
|
484 // -----
|
|
485
|
|
486 // expected-error@+1 {{expected three consecutive dots for an ellipsis}}
|
|
487 func @malformed_ellipsis_one(.)
|
|
488
|
|
489 // -----
|
|
490
|
|
491 // expected-error@+1 {{expected three consecutive dots for an ellipsis}}
|
|
492 func @malformed_ellipsis_two(..)
|
|
493
|
|
494 // -----
|
|
495
|
|
496 // expected-error@+1 {{expected non-function type}}
|
|
497 func @func_variadic(...)
|
|
498
|
|
499 // -----
|
|
500
|
|
501 func @redef() // expected-note {{see existing symbol definition here}}
|
|
502 func @redef() // expected-error {{redefinition of symbol named 'redef'}}
|
|
503
|
|
504 // -----
|
|
505
|
|
506 func @foo() {
|
|
507 ^bb0:
|
|
508 %x = constant @foo : (i32) -> () // expected-error {{reference to function with mismatched type}}
|
|
509 return
|
|
510 }
|
|
511
|
|
512 // -----
|
|
513
|
|
514 func @undefined_function() {
|
|
515 ^bb0:
|
|
516 %x = constant @bar : (i32) -> () // expected-error {{reference to undefined function 'bar'}}
|
|
517 return
|
|
518 }
|
|
519
|
|
520 // -----
|
|
521
|
|
522 #map1 = affine_map<(i)[j] -> (i+j)>
|
|
523
|
|
524 func @bound_symbol_mismatch(%N : index) {
|
|
525 affine.for %i = #map1(%N) to 100 {
|
173
|
526 // expected-error@-1 {{symbol operand count and affine map symbol count must match}}
|
150
|
527 }
|
|
528 return
|
|
529 }
|
|
530
|
|
531 // -----
|
|
532
|
|
533 #map1 = affine_map<(i)[j] -> (i+j)>
|
|
534
|
|
535 func @bound_dim_mismatch(%N : index) {
|
|
536 affine.for %i = #map1(%N, %N)[%N] to 100 {
|
173
|
537 // expected-error@-1 {{dim operand count and affine map dim count must match}}
|
150
|
538 }
|
|
539 return
|
|
540 }
|
|
541
|
|
542 // -----
|
|
543
|
|
544 func @large_bound() {
|
|
545 affine.for %i = 1 to 9223372036854775810 {
|
|
546 // expected-error@-1 {{integer constant out of range for attribute}}
|
|
547 }
|
|
548 return
|
|
549 }
|
|
550
|
|
551 // -----
|
|
552
|
|
553 func @max_in_upper_bound(%N : index) {
|
|
554 affine.for %i = 1 to max affine_map<(i)->(N, 100)> { //expected-error {{expected non-function type}}
|
|
555 }
|
|
556 return
|
|
557 }
|
|
558
|
|
559 // -----
|
|
560
|
|
561 func @step_typo() {
|
|
562 affine.for %i = 1 to 100 step -- 1 { //expected-error {{expected constant integer}}
|
|
563 }
|
|
564 return
|
|
565 }
|
|
566
|
|
567 // -----
|
|
568
|
|
569 func @invalid_bound_map(%N : i32) {
|
|
570 affine.for %i = 1 to affine_map<(i)->(j)>(%N) { //expected-error {{use of undeclared identifier}}
|
|
571 }
|
|
572 return
|
|
573 }
|
|
574
|
|
575 // -----
|
|
576
|
|
577 #set0 = affine_set<(i)[N, M] : )i >= 0)> // expected-error {{expected '(' at start of integer set constraint list}}
|
|
578
|
|
579 // -----
|
|
580 #set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)>
|
|
581
|
|
582 func @invalid_if_operands1(%N : index) {
|
|
583 affine.for %i = 1 to 10 {
|
|
584 affine.if #set0(%i) {
|
|
585 // expected-error@-1 {{symbol operand count and integer set symbol count must match}}
|
|
586
|
|
587 // -----
|
|
588 #set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)>
|
|
589
|
|
590 func @invalid_if_operands2(%N : index) {
|
|
591 affine.for %i = 1 to 10 {
|
|
592 affine.if #set0()[%N] {
|
|
593 // expected-error@-1 {{dim operand count and integer set dim count must match}}
|
|
594
|
|
595 // -----
|
|
596 #set0 = affine_set<(i)[N] : (i >= 0, N - i >= 0)>
|
|
597
|
|
598 func @invalid_if_operands3(%N : index) {
|
|
599 affine.for %i = 1 to 10 {
|
|
600 affine.if #set0(%i)[%i] {
|
|
601 // expected-error@-1 {{operand cannot be used as a symbol}}
|
|
602 }
|
|
603 }
|
|
604 return
|
|
605 }
|
|
606
|
|
607 // -----
|
|
608 // expected-error@+1 {{expected '"' in string literal}}
|
|
609 "J// -----
|
|
610 func @calls(%arg0: i32) {
|
|
611 // expected-error@+1 {{expected non-function type}}
|
|
612 %z = "casdasda"(%x) : (ppop32) -> i32
|
|
613 }
|
|
614 // -----
|
|
615 // expected-error@+2 {{expected SSA operand}}
|
|
616 func@n(){^b(
|
|
617 // -----
|
|
618
|
|
619 func @elementsattr_non_tensor_type() -> () {
|
|
620 ^bb0:
|
|
621 "foo"(){bar = dense<[4]> : i32} : () -> () // expected-error {{elements literal must be a ranked tensor or vector type}}
|
|
622 }
|
|
623
|
|
624 // -----
|
|
625
|
|
626 func @elementsattr_non_ranked() -> () {
|
|
627 ^bb0:
|
|
628 "foo"(){bar = dense<[4]> : tensor<?xi32>} : () -> () // expected-error {{elements literal type must have static shape}}
|
|
629 }
|
|
630
|
|
631 // -----
|
|
632
|
|
633 func @elementsattr_shape_mismatch() -> () {
|
|
634 ^bb0:
|
|
635 "foo"(){bar = dense<[4]> : tensor<5xi32>} : () -> () // expected-error {{inferred shape of elements literal ([1]) does not match type ([5])}}
|
|
636 }
|
|
637
|
|
638 // -----
|
|
639
|
|
640 func @elementsattr_invalid() -> () {
|
|
641 ^bb0:
|
|
642 "foo"(){bar = dense<[4, [5]]> : tensor<2xi32>} : () -> () // expected-error {{tensor literal is invalid; ranks are not consistent between elements}}
|
|
643 }
|
|
644
|
|
645 // -----
|
|
646
|
|
647 func @elementsattr_badtoken() -> () {
|
|
648 ^bb0:
|
|
649 "foo"(){bar = dense<[tf_opaque]> : tensor<1xi32>} : () -> () // expected-error {{expected element literal of primitive type}}
|
|
650 }
|
|
651
|
|
652 // -----
|
|
653
|
|
654 func @elementsattr_floattype1() -> () {
|
|
655 ^bb0:
|
|
656 // expected-error@+1 {{expected integer elements, but parsed floating-point}}
|
|
657 "foo"(){bar = dense<[4.0]> : tensor<1xi32>} : () -> ()
|
|
658 }
|
|
659
|
|
660 // -----
|
|
661
|
|
662 func @elementsattr_floattype1() -> () {
|
|
663 ^bb0:
|
|
664 // expected-error@+1 {{expected integer elements, but parsed floating-point}}
|
|
665 "foo"(){bar = dense<4.0> : tensor<i32>} : () -> ()
|
|
666 }
|
|
667
|
|
668 // -----
|
|
669
|
|
670 func @elementsattr_floattype2() -> () {
|
|
671 ^bb0:
|
|
672 // expected-error@+1 {{expected floating-point elements, but parsed integer}}
|
|
673 "foo"(){bar = dense<[4]> : tensor<1xf32>} : () -> ()
|
|
674 }
|
|
675
|
|
676 // -----
|
|
677
|
|
678 func @elementsattr_toolarge1() -> () {
|
|
679 ^bb0:
|
|
680 "foo"(){bar = dense<[777]> : tensor<1xi8>} : () -> () // expected-error {{integer constant out of range}}
|
|
681 }
|
|
682
|
|
683 // -----
|
|
684
|
|
685 func @elementsattr_toolarge2() -> () {
|
|
686 ^bb0:
|
|
687 "foo"(){bar = dense<[-777]> : tensor<1xi8>} : () -> () // expected-error {{integer constant out of range}}
|
|
688 }
|
|
689
|
|
690 // -----
|
|
691
|
173
|
692 "foo"(){bar = dense<[()]> : tensor<complex<i64>>} : () -> () // expected-error {{expected element literal of primitive type}}
|
|
693
|
|
694 // -----
|
|
695
|
|
696 "foo"(){bar = dense<[(10)]> : tensor<complex<i64>>} : () -> () // expected-error {{expected ',' between complex elements}}
|
|
697
|
|
698 // -----
|
|
699
|
|
700 "foo"(){bar = dense<[(10,)]> : tensor<complex<i64>>} : () -> () // expected-error {{expected element literal of primitive type}}
|
|
701
|
|
702 // -----
|
|
703
|
|
704 "foo"(){bar = dense<[(10,10]> : tensor<complex<i64>>} : () -> () // expected-error {{expected ')' after complex elements}}
|
|
705
|
|
706 // -----
|
|
707
|
150
|
708 func @elementsattr_malformed_opaque() -> () {
|
|
709 ^bb0:
|
|
710 "foo"(){bar = opaque<10, "0xQZz123"> : tensor<1xi8>} : () -> () // expected-error {{expected dialect namespace}}
|
|
711 }
|
|
712
|
|
713 // -----
|
|
714
|
|
715 func @elementsattr_malformed_opaque1() -> () {
|
|
716 ^bb0:
|
173
|
717 "foo"(){bar = opaque<"", "0xQZz123"> : tensor<1xi8>} : () -> () // expected-error {{elements hex string only contains hex digits}}
|
150
|
718 }
|
|
719
|
|
720 // -----
|
|
721
|
|
722 func @elementsattr_malformed_opaque2() -> () {
|
|
723 ^bb0:
|
173
|
724 "foo"(){bar = opaque<"", "00abc"> : tensor<1xi8>} : () -> () // expected-error {{elements hex string should start with '0x'}}
|
150
|
725 }
|
|
726
|
|
727 // -----
|
|
728
|
|
729 func @elementsattr_malformed_opaque3() -> () {
|
|
730 ^bb0:
|
|
731 "foo"(){bar = opaque<"t", "0xabc"> : tensor<1xi8>} : () -> () // expected-error {{no registered dialect with namespace 't'}}
|
|
732 }
|
|
733
|
|
734 // -----
|
|
735
|
|
736 func @redundant_signature(%a : i32) -> () {
|
|
737 ^bb0(%b : i32): // expected-error {{invalid block name in region with named arguments}}
|
|
738 return
|
|
739 }
|
|
740
|
|
741 // -----
|
|
742
|
|
743 func @mixed_named_arguments(%a : i32,
|
|
744 f32) -> () {
|
|
745 // expected-error @-1 {{expected SSA identifier}}
|
|
746 return
|
|
747 }
|
|
748
|
|
749 // -----
|
|
750
|
|
751 func @mixed_named_arguments(f32,
|
|
752 %a : i32) -> () { // expected-error {{expected type instead of SSA identifier}}
|
|
753 return
|
|
754 }
|
|
755
|
|
756 // -----
|
|
757
|
|
758 // This used to crash the parser, but should just error out by interpreting
|
|
759 // `tensor` as operator rather than as a type.
|
|
760 func @f(f32) {
|
|
761 ^bb0(%a : f32):
|
|
762 %18 = cmpi "slt", %idx, %idx : index
|
|
763 tensor<42 x index // expected-error {{custom op 'tensor' is unknown}}
|
|
764 return
|
|
765 }
|
|
766
|
|
767 // -----
|
|
768
|
|
769 func @f(%m : memref<?x?xf32>) {
|
|
770 affine.for %i0 = 0 to 42 {
|
|
771 // expected-note@+1 {{previously referenced here}}
|
|
772 %x = load %m[%i0, %i1] : memref<?x?xf32>
|
|
773 }
|
|
774 // expected-error@+1 {{region entry argument '%i1' is already in use}}
|
|
775 affine.for %i1 = 0 to 42 {
|
|
776 }
|
|
777 return
|
|
778 }
|
|
779
|
|
780 // -----
|
|
781
|
|
782 func @dialect_type_empty_namespace(!<"">) -> () { // expected-error {{invalid type identifier}}
|
|
783 return
|
|
784 }
|
|
785
|
|
786 // -----
|
|
787
|
|
788 func @dialect_type_no_string_type_data(!foo<>) -> () { // expected-error {{expected string literal data in dialect symbol}}
|
|
789 return
|
|
790 }
|
|
791
|
|
792 // -----
|
|
793
|
|
794 func @dialect_type_missing_greater(!foo<"") -> () { // expected-error {{expected '>' in dialect symbol}}
|
|
795 return
|
|
796 }
|
|
797
|
|
798 // -----
|
|
799
|
|
800 func @type_alias_unknown(!unknown_alias) -> () { // expected-error {{undefined symbol alias id 'unknown_alias'}}
|
|
801 return
|
|
802 }
|
|
803
|
|
804 // -----
|
|
805
|
|
806 // expected-error @+1 {{type names with a '.' are reserved for dialect-defined names}}
|
|
807 !foo.bar = i32
|
|
808
|
|
809 // -----
|
|
810
|
|
811 !missing_eq_alias type i32 // expected-error {{expected '=' in type alias definition}}
|
|
812
|
|
813 // -----
|
|
814
|
|
815 !missing_kw_type_alias = i32 // expected-error {{expected 'type' in type alias definition}}
|
|
816
|
|
817 // -----
|
|
818
|
|
819 !missing_type_alias = type // expected-error@+2 {{expected non-function type}}
|
|
820
|
|
821 // -----
|
|
822
|
|
823 !redef_alias = type i32
|
|
824 !redef_alias = type i32 // expected-error {{redefinition of type alias id 'redef_alias'}}
|
|
825
|
|
826 // -----
|
|
827
|
|
828 // Check ill-formed opaque tensor.
|
|
829 func @complex_loops() {
|
|
830 affine.for %i1 = 1 to 100 {
|
|
831 // expected-error @+1 {{expected '"' in string literal}}
|
|
832 "opaqueIntTensor"(){bar = opaque<"", "0x686]> : tensor<2x1x4xi32>} : () -> ()
|
|
833
|
|
834 // -----
|
|
835
|
|
836 func @mi() {
|
|
837 // expected-error @+1 {{expected element literal of primitive type}}
|
|
838 "fooi64"(){bar = sparse<vector<1xi64>,[,[,1]
|
|
839
|
|
840 // -----
|
|
841
|
|
842 func @invalid_tensor_literal() {
|
|
843 // expected-error @+1 {{expected 1-d tensor for values}}
|
|
844 "foof16"(){bar = sparse<[[0, 0, 0]], [[-2.0]]> : vector<1x1x1xf16>} : () -> ()
|
|
845
|
|
846 // -----
|
|
847
|
|
848 func @invalid_tensor_literal() {
|
|
849 // expected-error @+1 {{expected element literal of primitive type}}
|
|
850 "fooi16"(){bar = sparse<[[1, 1, 0], [0, 1, 0], [0,, [[0, 0, 0]], [-2.0]> : tensor<2x2x2xi16>} : () -> ()
|
|
851
|
|
852 // -----
|
|
853
|
|
854 func @invalid_affine_structure() {
|
|
855 %c0 = constant 0 : index
|
|
856 %idx = affine.apply affine_map<(d0, d1)> (%c0, %c0) // expected-error {{expected '->' or ':'}}
|
|
857 return
|
|
858 }
|
|
859
|
|
860 // -----
|
|
861
|
|
862 func @missing_for_max(%arg0: index, %arg1: index, %arg2: memref<100xf32>) {
|
|
863 // expected-error @+1 {{lower loop bound affine map with multiple results requires 'max' prefix}}
|
|
864 affine.for %i0 = affine_map<()[s]->(0,s-1)>()[%arg0] to %arg1 {
|
|
865 }
|
|
866 return
|
|
867 }
|
|
868
|
|
869 // -----
|
|
870
|
|
871 func @missing_for_min(%arg0: index, %arg1: index, %arg2: memref<100xf32>) {
|
|
872 // expected-error @+1 {{upper loop bound affine map with multiple results requires 'min' prefix}}
|
|
873 affine.for %i0 = %arg0 to affine_map<()[s]->(100,s+1)>()[%arg1] {
|
|
874 }
|
|
875 return
|
|
876 }
|
|
877
|
|
878 // -----
|
|
879
|
|
880 // expected-error @+1 {{vector types must have positive constant sizes}}
|
|
881 func @zero_vector_type() -> vector<0xi32>
|
|
882
|
|
883 // -----
|
|
884
|
|
885 // expected-error @+1 {{vector types must have positive constant sizes}}
|
|
886 func @zero_in_vector_type() -> vector<1x0xi32>
|
|
887
|
|
888 // -----
|
|
889
|
|
890 // expected-error @+1 {{expected dimension size in vector type}}
|
|
891 func @negative_vector_size() -> vector<-1xi32>
|
|
892
|
|
893 // -----
|
|
894
|
|
895 // expected-error @+1 {{expected non-function type}}
|
|
896 func @negative_in_vector_size() -> vector<1x-1xi32>
|
|
897
|
|
898 // -----
|
|
899
|
|
900 // expected-error @+1 {{expected non-function type}}
|
|
901 func @negative_memref_size() -> memref<-1xi32>
|
|
902
|
|
903 // -----
|
|
904
|
|
905 // expected-error @+1 {{expected non-function type}}
|
|
906 func @negative_in_memref_size() -> memref<1x-1xi32>
|
|
907
|
|
908 // -----
|
|
909
|
|
910 // expected-error @+1 {{expected non-function type}}
|
|
911 func @negative_tensor_size() -> tensor<-1xi32>
|
|
912
|
|
913 // -----
|
|
914
|
|
915 // expected-error @+1 {{expected non-function type}}
|
|
916 func @negative_in_tensor_size() -> tensor<1x-1xi32>
|
|
917
|
|
918 // -----
|
|
919
|
|
920 func @invalid_nested_dominance() {
|
|
921 "foo.region"() ({
|
|
922 // expected-error @+1 {{operand #0 does not dominate this use}}
|
|
923 "foo.use" (%1) : (i32) -> ()
|
|
924 br ^bb2
|
|
925
|
|
926 ^bb2:
|
|
927 // expected-note @+1 {{operand defined here}}
|
|
928 %1 = constant 0 : i32
|
|
929 "foo.yield" () : () -> ()
|
|
930 }) : () -> ()
|
|
931 return
|
|
932 }
|
|
933
|
|
934 // -----
|
|
935
|
|
936 // expected-error @+1 {{unbalanced ']' character in pretty dialect name}}
|
|
937 func @invalid_unknown_type_dialect_name() -> !invalid.dialect<!x@#]!@#>
|
|
938
|
|
939 // -----
|
|
940
|
|
941 // expected-error @+1 {{@ identifier expected to start with letter or '_'}}
|
|
942 func @$invalid_function_name()
|
|
943
|
|
944 // -----
|
|
945
|
|
946 // expected-error @+1 {{arguments may only have dialect attributes}}
|
|
947 func @invalid_func_arg_attr(i1 {non_dialect_attr = 10})
|
|
948
|
|
949 // -----
|
|
950
|
|
951 // expected-error @+1 {{results may only have dialect attributes}}
|
|
952 func @invalid_func_result_attr() -> (i1 {non_dialect_attr = 10})
|
|
953
|
|
954 // -----
|
|
955
|
|
956 // expected-error @+1 {{expected '<' in tuple type}}
|
|
957 func @invalid_tuple_missing_less(tuple i32>)
|
|
958
|
|
959 // -----
|
|
960
|
|
961 // expected-error @+1 {{expected '>' in tuple type}}
|
|
962 func @invalid_tuple_missing_greater(tuple<i32)
|
|
963
|
|
964 // -----
|
|
965
|
|
966 // Should not crash because of deletion order here.
|
|
967 func @invalid_region_dominance() {
|
|
968 "foo.use" (%1) : (i32) -> ()
|
|
969 "foo.region"() ({
|
|
970 %1 = constant 0 : i32 // This value is used outside of the region.
|
|
971 "foo.yield" () : () -> ()
|
|
972 }, {
|
|
973 // expected-error @+1 {{expected operation name in quotes}}
|
|
974 %2 = constant 1 i32 // Syntax error causes region deletion.
|
|
975 }) : () -> ()
|
|
976 return
|
|
977 }
|
|
978
|
|
979 // -----
|
|
980
|
|
981 // Should not crash because of deletion order here.
|
|
982 func @invalid_region_block() {
|
|
983 "foo.branch"()[^bb2] : () -> () // Attempt to jump into the region.
|
|
984
|
|
985 ^bb1:
|
|
986 "foo.region"() ({
|
|
987 ^bb2:
|
|
988 "foo.yield"() : () -> ()
|
|
989 }, {
|
|
990 // expected-error @+1 {{expected operation name in quotes}}
|
|
991 %2 = constant 1 i32 // Syntax error causes region deletion.
|
|
992 }) : () -> ()
|
|
993 }
|
|
994
|
|
995 // -----
|
|
996
|
|
997 // Should not crash because of deletion order here.
|
|
998 func @invalid_region_dominance() {
|
|
999 "foo.use" (%1) : (i32) -> ()
|
|
1000 "foo.region"() ({
|
|
1001 "foo.region"() ({
|
|
1002 %1 = constant 0 : i32 // This value is used outside of the region.
|
|
1003 "foo.yield" () : () -> ()
|
|
1004 }) : () -> ()
|
|
1005 }, {
|
|
1006 // expected-error @+1 {{expected operation name in quotes}}
|
|
1007 %2 = constant 1 i32 // Syntax error causes region deletion.
|
|
1008 }) : () -> ()
|
|
1009 return
|
|
1010 }
|
|
1011
|
|
1012 // -----
|
|
1013
|
|
1014 func @unfinished_region_list() {
|
|
1015 // expected-error@+1 {{expected ')' to end region list}}
|
|
1016 "region"() ({},{},{} : () -> ()
|
|
1017 }
|
|
1018
|
|
1019 // -----
|
|
1020
|
|
1021 func @multi_result_missing_count() {
|
|
1022 // expected-error@+1 {{expected integer number of results}}
|
|
1023 %0: = "foo" () : () -> (i32, i32)
|
|
1024 return
|
|
1025 }
|
|
1026
|
|
1027 // -----
|
|
1028
|
|
1029 func @multi_result_zero_count() {
|
|
1030 // expected-error@+1 {{expected named operation to have atleast 1 result}}
|
|
1031 %0:0 = "foo" () : () -> (i32, i32)
|
|
1032 return
|
|
1033 }
|
|
1034
|
|
1035 // -----
|
|
1036
|
|
1037 func @multi_result_invalid_identifier() {
|
|
1038 // expected-error@+1 {{expected valid ssa identifier}}
|
|
1039 %0, = "foo" () : () -> (i32, i32)
|
|
1040 return
|
|
1041 }
|
|
1042
|
|
1043 // -----
|
|
1044
|
|
1045 func @multi_result_mismatch_count() {
|
|
1046 // expected-error@+1 {{operation defines 2 results but was provided 1 to bind}}
|
|
1047 %0:1 = "foo" () : () -> (i32, i32)
|
|
1048 return
|
|
1049 }
|
|
1050
|
|
1051 // -----
|
|
1052
|
|
1053 func @multi_result_mismatch_count() {
|
|
1054 // expected-error@+1 {{operation defines 2 results but was provided 3 to bind}}
|
|
1055 %0, %1, %3 = "foo" () : () -> (i32, i32)
|
|
1056 return
|
|
1057 }
|
|
1058
|
|
1059 // -----
|
|
1060
|
|
1061 func @no_result_with_name() {
|
|
1062 // expected-error@+1 {{cannot name an operation with no results}}
|
|
1063 %0 = "foo" () : () -> ()
|
|
1064 return
|
|
1065 }
|
|
1066
|
|
1067 // -----
|
|
1068
|
|
1069 func @conflicting_names() {
|
|
1070 // expected-note@+1 {{previously defined here}}
|
|
1071 %foo, %bar = "foo" () : () -> (i32, i32)
|
|
1072
|
|
1073 // expected-error@+1 {{redefinition of SSA value '%bar'}}
|
|
1074 %bar, %baz = "foo" () : () -> (i32, i32)
|
|
1075 return
|
|
1076 }
|
|
1077
|
|
1078 // -----
|
|
1079
|
|
1080 func @ssa_name_missing_eq() {
|
|
1081 // expected-error@+1 {{expected '=' after SSA name}}
|
|
1082 %0:2 "foo" () : () -> (i32, i32)
|
|
1083 return
|
|
1084 }
|
|
1085
|
|
1086 // -----
|
|
1087
|
|
1088 // expected-error @+1 {{invalid element type for complex}}
|
|
1089 func @bad_complex(complex<memref<2x4xi8>>)
|
|
1090
|
|
1091 // -----
|
|
1092
|
|
1093 // expected-error @+1 {{expected '<' in complex type}}
|
|
1094 func @bad_complex(complex memref<2x4xi8>>)
|
|
1095
|
|
1096 // -----
|
|
1097
|
|
1098 // expected-error @+1 {{expected '>' in complex type}}
|
|
1099 func @bad_complex(complex<i32)
|
|
1100
|
|
1101 // -----
|
|
1102
|
|
1103 // expected-error @+1 {{attribute names with a '.' are reserved for dialect-defined names}}
|
|
1104 #foo.attr = i32
|
|
1105
|
|
1106 // -----
|
|
1107
|
|
1108 func @invalid_region_dominance() {
|
|
1109 "foo.region"() ({
|
|
1110 // expected-error @+1 {{operand #0 does not dominate this use}}
|
|
1111 "foo.use" (%def) : (i32) -> ()
|
|
1112 "foo.yield" () : () -> ()
|
|
1113 }, {
|
|
1114 // expected-note @+1 {{operand defined here}}
|
|
1115 %def = "foo.def" () : () -> i32
|
|
1116 }) : () -> ()
|
|
1117 return
|
|
1118 }
|
|
1119
|
|
1120 // -----
|
|
1121
|
|
1122 func @invalid_region_dominance() {
|
|
1123 // expected-note @+1 {{operand defined here}}
|
|
1124 %def = "foo.region_with_def"() ({
|
|
1125 // expected-error @+1 {{operand #0 does not dominate this use}}
|
|
1126 "foo.use" (%def) : (i32) -> ()
|
|
1127 "foo.yield" () : () -> ()
|
|
1128 }) : () -> (i32)
|
|
1129 return
|
|
1130 }
|
|
1131
|
|
1132 // -----
|
|
1133
|
|
1134 func @hexadecimal_float_leading_minus() {
|
|
1135 // expected-error @+1 {{hexadecimal float literal should not have a leading minus}}
|
|
1136 "foo"() {value = -0x7fff : f16} : () -> ()
|
|
1137 }
|
|
1138
|
|
1139 // -----
|
|
1140
|
|
1141 func @hexadecimal_float_literal_overflow() {
|
|
1142 // expected-error @+1 {{hexadecimal float constant out of range for type}}
|
|
1143 "foo"() {value = 0xffffffff : f16} : () -> ()
|
|
1144 }
|
|
1145
|
|
1146 // -----
|
|
1147
|
|
1148 func @decimal_float_literal() {
|
|
1149 // expected-error @+2 {{unexpected decimal integer literal for a float attribute}}
|
|
1150 // expected-note @+1 {{add a trailing dot to make the literal a float}}
|
|
1151 "foo"() {value = 42 : f32} : () -> ()
|
|
1152 }
|
|
1153
|
|
1154 // -----
|
|
1155
|
|
1156 func @float_in_int_tensor() {
|
|
1157 // expected-error @+1 {{expected integer elements, but parsed floating-point}}
|
|
1158 "foo"() {bar = dense<[42.0, 42]> : tensor<2xi32>} : () -> ()
|
|
1159 }
|
|
1160
|
|
1161 // -----
|
|
1162
|
|
1163 func @float_in_bool_tensor() {
|
|
1164 // expected-error @+1 {{expected integer elements, but parsed floating-point}}
|
|
1165 "foo"() {bar = dense<[true, 42.0]> : tensor<2xi1>} : () -> ()
|
|
1166 }
|
|
1167
|
|
1168 // -----
|
|
1169
|
|
1170 func @decimal_int_in_float_tensor() {
|
|
1171 // expected-error @+1 {{expected floating-point elements, but parsed integer}}
|
|
1172 "foo"() {bar = dense<[42, 42.0]> : tensor<2xf32>} : () -> ()
|
|
1173 }
|
|
1174
|
|
1175 // -----
|
|
1176
|
|
1177 func @bool_in_float_tensor() {
|
|
1178 // expected-error @+1 {{expected floating-point elements, but parsed integer}}
|
|
1179 "foo"() {bar = dense<[42.0, true]> : tensor<2xf32>} : () -> ()
|
|
1180 }
|
|
1181
|
|
1182 // -----
|
|
1183
|
|
1184 func @hexadecimal_float_leading_minus_in_tensor() {
|
|
1185 // expected-error @+1 {{hexadecimal float literal should not have a leading minus}}
|
|
1186 "foo"() {bar = dense<-0x7FFFFFFF> : tensor<2xf32>} : () -> ()
|
|
1187 }
|
|
1188
|
|
1189 // -----
|
|
1190
|
|
1191 // Check that we report an error when a value could be parsed, but does not fit
|
|
1192 // into the specified type.
|
|
1193 func @hexadecimal_float_too_wide_for_type_in_tensor() {
|
|
1194 // expected-error @+1 {{hexadecimal float constant out of range for type}}
|
|
1195 "foo"() {bar = dense<0x7FF0000000000000> : tensor<2xf32>} : () -> ()
|
|
1196 }
|
|
1197
|
|
1198 // -----
|
|
1199
|
|
1200 // Check that we report an error when a value is too wide to be parsed.
|
|
1201 func @hexadecimal_float_too_wide_in_tensor() {
|
|
1202 // expected-error @+1 {{hexadecimal float constant out of range for attribute}}
|
|
1203 "foo"() {bar = dense<0x7FFFFFF0000000000000> : tensor<2xf32>} : () -> ()
|
|
1204 }
|
|
1205
|
|
1206 // -----
|
|
1207
|
|
1208 func @integer_too_wide_in_tensor() {
|
|
1209 // expected-error @+1 {{integer constant out of range for type}}
|
|
1210 "foo"() {bar = dense<0xFFFFFFFFFFFFFF> : tensor<2xi16>} : () -> ()
|
|
1211 }
|
|
1212
|
|
1213 // -----
|
|
1214
|
|
1215 func @bool_literal_in_non_bool_tensor() {
|
|
1216 // expected-error @+1 {{expected i1 type for 'true' or 'false' values}}
|
|
1217 "foo"() {bar = dense<true> : tensor<2xi16>} : () -> ()
|
|
1218 }
|
|
1219
|
173
|
1220 // -----
|
|
1221
|
150
|
1222 // expected-error @+1 {{unbalanced ')' character in pretty dialect name}}
|
|
1223 func @bad_arrow(%arg : !unreg.ptr<(i32)->)
|
173
|
1224
|
|
1225 // -----
|
|
1226
|
|
1227 func @negative_value_in_unsigned_int_attr() {
|
|
1228 // expected-error @+1 {{negative integer literal not valid for unsigned integer type}}
|
|
1229 "foo"() {bar = -5 : ui32} : () -> ()
|
|
1230 }
|
|
1231
|
|
1232 // -----
|
|
1233
|
|
1234 func @negative_value_in_unsigned_vector_attr() {
|
|
1235 // expected-error @+1 {{expected unsigned integer elements, but parsed negative value}}
|
|
1236 "foo"() {bar = dense<[5, -5]> : vector<2xui32>} : () -> ()
|
|
1237 }
|
|
1238
|
|
1239 // -----
|
|
1240
|
|
1241 func @large_bound() {
|
|
1242 "test.out_of_range_attribute"() {
|
|
1243 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1244 attr = -129 : i8
|
|
1245 } : () -> ()
|
|
1246 return
|
|
1247 }
|
|
1248
|
|
1249 // -----
|
|
1250
|
|
1251 func @large_bound() {
|
|
1252 "test.out_of_range_attribute"() {
|
|
1253 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1254 attr = 256 : i8
|
|
1255 } : () -> ()
|
|
1256 return
|
|
1257 }
|
|
1258
|
|
1259 // -----
|
|
1260
|
|
1261 func @large_bound() {
|
|
1262 "test.out_of_range_attribute"() {
|
|
1263 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1264 attr = -129 : si8
|
|
1265 } : () -> ()
|
|
1266 return
|
|
1267 }
|
|
1268
|
|
1269 // -----
|
|
1270
|
|
1271 func @large_bound() {
|
|
1272 "test.out_of_range_attribute"() {
|
|
1273 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1274 attr = 129 : si8
|
|
1275 } : () -> ()
|
|
1276 return
|
|
1277 }
|
|
1278
|
|
1279 // -----
|
|
1280
|
|
1281 func @large_bound() {
|
|
1282 "test.out_of_range_attribute"() {
|
|
1283 // expected-error @+1 {{negative integer literal not valid for unsigned integer type}}
|
|
1284 attr = -1 : ui8
|
|
1285 } : () -> ()
|
|
1286 return
|
|
1287 }
|
|
1288
|
|
1289 // -----
|
|
1290
|
|
1291 func @large_bound() {
|
|
1292 "test.out_of_range_attribute"() {
|
|
1293 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1294 attr = 256 : ui8
|
|
1295 } : () -> ()
|
|
1296 return
|
|
1297 }
|
|
1298
|
|
1299 // -----
|
|
1300
|
|
1301 func @large_bound() {
|
|
1302 "test.out_of_range_attribute"() {
|
|
1303 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1304 attr = -32769 : i16
|
|
1305 } : () -> ()
|
|
1306 return
|
|
1307 }
|
|
1308
|
|
1309 // -----
|
|
1310
|
|
1311 func @large_bound() {
|
|
1312 "test.out_of_range_attribute"() {
|
|
1313 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1314 attr = 65536 : i16
|
|
1315 } : () -> ()
|
|
1316 return
|
|
1317 }
|
|
1318
|
|
1319 // -----
|
|
1320
|
|
1321 func @large_bound() {
|
|
1322 "test.out_of_range_attribute"() {
|
|
1323 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1324 attr = -32769 : si16
|
|
1325 } : () -> ()
|
|
1326 return
|
|
1327 }
|
|
1328
|
|
1329 // -----
|
|
1330
|
|
1331 func @large_bound() {
|
|
1332 "test.out_of_range_attribute"() {
|
|
1333 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1334 attr = 32768 : si16
|
|
1335 } : () -> ()
|
|
1336 return
|
|
1337 }
|
|
1338
|
|
1339 // -----
|
|
1340
|
|
1341 func @large_bound() {
|
|
1342 "test.out_of_range_attribute"() {
|
|
1343 // expected-error @+1 {{negative integer literal not valid for unsigned integer type}}
|
|
1344 attr = -1 : ui16
|
|
1345 } : () -> ()
|
|
1346 return
|
|
1347 }
|
|
1348
|
|
1349 // -----
|
|
1350
|
|
1351 func @large_bound() {
|
|
1352 "test.out_of_range_attribute"() {
|
|
1353 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1354 attr = 65536: ui16
|
|
1355 } : () -> ()
|
|
1356 return
|
|
1357 }
|
|
1358
|
|
1359 // -----
|
|
1360
|
|
1361 func @large_bound() {
|
|
1362 "test.out_of_range_attribute"() {
|
|
1363 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1364 attr = -2147483649 : i32
|
|
1365 } : () -> ()
|
|
1366 return
|
|
1367 }
|
|
1368
|
|
1369 // -----
|
|
1370
|
|
1371 func @large_bound() {
|
|
1372 "test.out_of_range_attribute"() {
|
|
1373 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1374 attr = 4294967296 : i32
|
|
1375 } : () -> ()
|
|
1376 return
|
|
1377 }
|
|
1378
|
|
1379 // -----
|
|
1380
|
|
1381 func @large_bound() {
|
|
1382 "test.out_of_range_attribute"() {
|
|
1383 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1384 attr = -2147483649 : si32
|
|
1385 } : () -> ()
|
|
1386 return
|
|
1387 }
|
|
1388
|
|
1389 // -----
|
|
1390
|
|
1391 func @large_bound() {
|
|
1392 "test.out_of_range_attribute"() {
|
|
1393 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1394 attr = 2147483648 : si32
|
|
1395 } : () -> ()
|
|
1396 return
|
|
1397 }
|
|
1398
|
|
1399 // -----
|
|
1400
|
|
1401 func @large_bound() {
|
|
1402 "test.out_of_range_attribute"() {
|
|
1403 // expected-error @+1 {{negative integer literal not valid for unsigned integer type}}
|
|
1404 attr = -1 : ui32
|
|
1405 } : () -> ()
|
|
1406 return
|
|
1407 }
|
|
1408
|
|
1409 // -----
|
|
1410
|
|
1411 func @large_bound() {
|
|
1412 "test.out_of_range_attribute"() {
|
|
1413 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1414 attr = 4294967296 : ui32
|
|
1415 } : () -> ()
|
|
1416 return
|
|
1417 }
|
|
1418
|
|
1419 // -----
|
|
1420
|
|
1421 func @large_bound() {
|
|
1422 "test.out_of_range_attribute"() {
|
|
1423 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1424 attr = -9223372036854775809 : i64
|
|
1425 } : () -> ()
|
|
1426 return
|
|
1427 }
|
|
1428
|
|
1429 // -----
|
|
1430
|
|
1431 func @large_bound() {
|
|
1432 "test.out_of_range_attribute"() {
|
|
1433 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1434 attr = 18446744073709551616 : i64
|
|
1435 } : () -> ()
|
|
1436 return
|
|
1437 }
|
|
1438
|
|
1439 // -----
|
|
1440
|
|
1441 func @large_bound() {
|
|
1442 "test.out_of_range_attribute"() {
|
|
1443 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1444 attr = -9223372036854775809 : si64
|
|
1445 } : () -> ()
|
|
1446 return
|
|
1447 }
|
|
1448
|
|
1449 // -----
|
|
1450
|
|
1451 func @large_bound() {
|
|
1452 "test.out_of_range_attribute"() {
|
|
1453 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1454 attr = 9223372036854775808 : si64
|
|
1455 } : () -> ()
|
|
1456 return
|
|
1457 }
|
|
1458
|
|
1459 // -----
|
|
1460
|
|
1461 func @large_bound() {
|
|
1462 "test.out_of_range_attribute"() {
|
|
1463 // expected-error @+1 {{negative integer literal not valid for unsigned integer type}}
|
|
1464 attr = -1 : ui64
|
|
1465 } : () -> ()
|
|
1466 return
|
|
1467 }
|
|
1468
|
|
1469 // -----
|
|
1470
|
|
1471 func @large_bound() {
|
|
1472 "test.out_of_range_attribute"() {
|
|
1473 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1474 attr = 18446744073709551616 : ui64
|
|
1475 } : () -> ()
|
|
1476 return
|
|
1477 }
|
|
1478
|
|
1479 // -----
|
|
1480
|
|
1481 func @really_large_bound() {
|
|
1482 "test.out_of_range_attribute"() {
|
|
1483 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1484 attr = 79228162514264337593543950336 : ui96
|
|
1485 } : () -> ()
|
|
1486 return
|
|
1487 }
|
|
1488
|
|
1489 // -----
|
|
1490
|
|
1491 func @really_large_bound() {
|
|
1492 "test.out_of_range_attribute"() {
|
|
1493 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1494 attr = 79228162514264337593543950336 : i96
|
|
1495 } : () -> ()
|
|
1496 return
|
|
1497 }
|
|
1498
|
|
1499 // -----
|
|
1500
|
|
1501 func @really_large_bound() {
|
|
1502 "test.out_of_range_attribute"() {
|
|
1503 // expected-error @+1 {{integer constant out of range for attribute}}
|
|
1504 attr = 39614081257132168796771975168 : si96
|
|
1505 } : () -> ()
|
|
1506 return
|
|
1507 }
|
|
1508
|
|
1509 // -----
|
|
1510
|
|
1511 func @duplicate_dictionary_attr_key() {
|
|
1512 // expected-error @+1 {{duplicate key in dictionary attribute}}
|
|
1513 "foo.op"() {a, a} : () -> ()
|
|
1514 }
|
|
1515
|
|
1516 // -----
|
|
1517
|
|
1518 func @forward_reference_type_check() -> (i8) {
|
|
1519 br ^bb2
|
|
1520
|
|
1521 ^bb1:
|
|
1522 // expected-note @+1 {{previously used here with type 'i8'}}
|
|
1523 return %1 : i8
|
|
1524
|
|
1525 ^bb2:
|
|
1526 // expected-error @+1 {{definition of SSA value '%1#0' has type 'f32'}}
|
|
1527 %1 = "bar"() : () -> (f32)
|
|
1528 br ^bb1
|
|
1529 }
|
|
1530
|
|
1531 // -----
|
|
1532
|
|
1533 func @dominance_error_in_unreachable_op() -> i1 {
|
|
1534 %c = constant 0 : i1
|
|
1535 return %c : i1
|
|
1536 ^bb0:
|
|
1537 "dummy" () ({ // unreachable
|
|
1538 ^bb1:
|
|
1539 // expected-error @+1 {{operand #0 does not dominate this use}}
|
|
1540 %2:3 = "bar"(%1) : (i64) -> (i1,i1,i1)
|
|
1541 br ^bb4
|
|
1542 ^bb2:
|
|
1543 br ^bb2
|
|
1544 ^bb4:
|
|
1545 %1 = "foo"() : ()->i64 // expected-note {{operand defined here}}
|
|
1546 }) : () -> ()
|
|
1547 return %c : i1
|
|
1548 }
|