Mercurial > hg > CbC > CbC_llvm
comparison mlir/test/IR/invalid.mlir @ 173:0572611fdcc8 llvm10 llvm12
reorgnization done
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 25 May 2020 11:55:54 +0900 |
parents | 1d019706d866 |
children | 2e18cbf3894f |
comparison
equal
deleted
inserted
replaced
172:9fbae9c8bf63 | 173:0572611fdcc8 |
---|---|
1 // RUN: mlir-opt %s -split-input-file -verify-diagnostics | 1 // RUN: mlir-opt -allow-unregistered-dialect %s -split-input-file -verify-diagnostics |
2 | 2 |
3 // Check different error cases. | 3 // Check different error cases. |
4 // ----- | 4 // ----- |
5 | 5 |
6 func @illegaltype(i) // expected-error {{expected non-function type}} | 6 func @illegaltype(i) // expected-error {{expected non-function type}} |
20 func @indexvector(vector<4 x index>) -> () // expected-error {{vector elements must be int or float type}} | 20 func @indexvector(vector<4 x index>) -> () // expected-error {{vector elements must be int or float type}} |
21 | 21 |
22 // ----- | 22 // ----- |
23 | 23 |
24 func @indexmemref(memref<? x index>) -> () // expected-error {{invalid memref element type}} | 24 func @indexmemref(memref<? x index>) -> () // expected-error {{invalid memref element type}} |
25 | |
26 // ----- | |
27 | |
28 func @indextensor(tensor<4 x index>) -> () // expected-error {{invalid tensor element type}} | |
29 | 25 |
30 // ----- | 26 // ----- |
31 // Test no map in memref type. | 27 // Test no map in memref type. |
32 func @memrefs(memref<2x4xi8, >) // expected-error {{expected list element}} | 28 func @memrefs(memref<2x4xi8, >) // expected-error {{expected list element}} |
33 | 29 |
151 | 147 |
152 // ----- | 148 // ----- |
153 | 149 |
154 func @block_arg_no_close_paren() { | 150 func @block_arg_no_close_paren() { |
155 ^bb42: | 151 ^bb42: |
156 br ^bb2( // expected-error@+1 {{expected ')' to close argument list}} | 152 br ^bb2( // expected-error@+1 {{expected ':'}} |
157 return | 153 return |
158 } | 154 } |
159 | 155 |
160 // ----- | 156 // ----- |
161 | 157 |
392 | 388 |
393 func @condbr_notbool() { | 389 func @condbr_notbool() { |
394 ^bb0: | 390 ^bb0: |
395 %a = "foo"() : () -> i32 // expected-note {{prior use here}} | 391 %a = "foo"() : () -> i32 // expected-note {{prior use here}} |
396 cond_br %a, ^bb0, ^bb0 // expected-error {{use of value '%a' expects different type than prior uses: 'i1' vs 'i32'}} | 392 cond_br %a, ^bb0, ^bb0 // expected-error {{use of value '%a' expects different type than prior uses: 'i1' vs 'i32'}} |
397 // expected-error@-1 {{expected condition type was boolean (i1)}} | |
398 } | 393 } |
399 | 394 |
400 // ----- | 395 // ----- |
401 | 396 |
402 func @condbr_badtype() { | 397 func @condbr_badtype() { |
526 | 521 |
527 #map1 = affine_map<(i)[j] -> (i+j)> | 522 #map1 = affine_map<(i)[j] -> (i+j)> |
528 | 523 |
529 func @bound_symbol_mismatch(%N : index) { | 524 func @bound_symbol_mismatch(%N : index) { |
530 affine.for %i = #map1(%N) to 100 { | 525 affine.for %i = #map1(%N) to 100 { |
531 // expected-error@-1 {{symbol operand count and integer set symbol count must match}} | 526 // expected-error@-1 {{symbol operand count and affine map symbol count must match}} |
532 } | 527 } |
533 return | 528 return |
534 } | 529 } |
535 | 530 |
536 // ----- | 531 // ----- |
537 | 532 |
538 #map1 = affine_map<(i)[j] -> (i+j)> | 533 #map1 = affine_map<(i)[j] -> (i+j)> |
539 | 534 |
540 func @bound_dim_mismatch(%N : index) { | 535 func @bound_dim_mismatch(%N : index) { |
541 affine.for %i = #map1(%N, %N)[%N] to 100 { | 536 affine.for %i = #map1(%N, %N)[%N] to 100 { |
542 // expected-error@-1 {{dim operand count and integer set dim count must match}} | 537 // expected-error@-1 {{dim operand count and affine map dim count must match}} |
543 } | 538 } |
544 return | 539 return |
545 } | 540 } |
546 | 541 |
547 // ----- | 542 // ----- |
692 "foo"(){bar = dense<[-777]> : tensor<1xi8>} : () -> () // expected-error {{integer constant out of range}} | 687 "foo"(){bar = dense<[-777]> : tensor<1xi8>} : () -> () // expected-error {{integer constant out of range}} |
693 } | 688 } |
694 | 689 |
695 // ----- | 690 // ----- |
696 | 691 |
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 | |
697 func @elementsattr_malformed_opaque() -> () { | 708 func @elementsattr_malformed_opaque() -> () { |
698 ^bb0: | 709 ^bb0: |
699 "foo"(){bar = opaque<10, "0xQZz123"> : tensor<1xi8>} : () -> () // expected-error {{expected dialect namespace}} | 710 "foo"(){bar = opaque<10, "0xQZz123"> : tensor<1xi8>} : () -> () // expected-error {{expected dialect namespace}} |
700 } | 711 } |
701 | 712 |
702 // ----- | 713 // ----- |
703 | 714 |
704 func @elementsattr_malformed_opaque1() -> () { | 715 func @elementsattr_malformed_opaque1() -> () { |
705 ^bb0: | 716 ^bb0: |
706 "foo"(){bar = opaque<"", "0xQZz123"> : tensor<1xi8>} : () -> () // expected-error {{opaque string only contains hex digits}} | 717 "foo"(){bar = opaque<"", "0xQZz123"> : tensor<1xi8>} : () -> () // expected-error {{elements hex string only contains hex digits}} |
707 } | 718 } |
708 | 719 |
709 // ----- | 720 // ----- |
710 | 721 |
711 func @elementsattr_malformed_opaque2() -> () { | 722 func @elementsattr_malformed_opaque2() -> () { |
712 ^bb0: | 723 ^bb0: |
713 "foo"(){bar = opaque<"", "00abc"> : tensor<1xi8>} : () -> () // expected-error {{opaque string should start with '0x'}} | 724 "foo"(){bar = opaque<"", "00abc"> : tensor<1xi8>} : () -> () // expected-error {{elements hex string should start with '0x'}} |
714 } | 725 } |
715 | 726 |
716 // ----- | 727 // ----- |
717 | 728 |
718 func @elementsattr_malformed_opaque3() -> () { | 729 func @elementsattr_malformed_opaque3() -> () { |
1204 func @bool_literal_in_non_bool_tensor() { | 1215 func @bool_literal_in_non_bool_tensor() { |
1205 // expected-error @+1 {{expected i1 type for 'true' or 'false' values}} | 1216 // expected-error @+1 {{expected i1 type for 'true' or 'false' values}} |
1206 "foo"() {bar = dense<true> : tensor<2xi16>} : () -> () | 1217 "foo"() {bar = dense<true> : tensor<2xi16>} : () -> () |
1207 } | 1218 } |
1208 | 1219 |
1220 // ----- | |
1221 | |
1209 // expected-error @+1 {{unbalanced ')' character in pretty dialect name}} | 1222 // expected-error @+1 {{unbalanced ')' character in pretty dialect name}} |
1210 func @bad_arrow(%arg : !unreg.ptr<(i32)->) | 1223 func @bad_arrow(%arg : !unreg.ptr<(i32)->) |
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 } |