Commit 2d4d707
committed
[GlobalISelMatchTable] Don't hoist C++ predicates over operand recorders
The pattern optimizations in GlobalISelMatchTable.cpp can extract common
predicates out of pattern alternatives by putting the pattern alternatives into
a GroupMatcher and moving common predicates into the GroupMatcher's predicate
list. This patch adds checks to avoid hoisting a common predicate before
matchers that record named operands that the predicate uses, which would lead
to segfaults when the imported patterns are matched.
See the added test for a concrete example inspired by the AMDGPU backend.
This fixes a bug encountered in #143881.1 parent a134b06 commit 2d4d707
File tree
3 files changed
+108
-3
lines changed- llvm
- test/TableGen/GlobalISelEmitter
- utils/TableGen/Common/GlobalISel
3 files changed
+108
-3
lines changedLines changed: 43 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
Lines changed: 49 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
158 | 162 | | |
159 | 163 | | |
160 | 164 | | |
| |||
457 | 461 | | |
458 | 462 | | |
459 | 463 | | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
460 | 468 | | |
461 | 469 | | |
462 | 470 | | |
| |||
486 | 494 | | |
487 | 495 | | |
488 | 496 | | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
489 | 507 | | |
490 | 508 | | |
491 | 509 | | |
492 | 510 | | |
| 511 | + | |
| 512 | + | |
493 | 513 | | |
494 | | - | |
| 514 | + | |
| 515 | + | |
495 | 516 | | |
496 | 517 | | |
497 | 518 | | |
| |||
509 | 530 | | |
510 | 531 | | |
511 | 532 | | |
| 533 | + | |
| 534 | + | |
512 | 535 | | |
513 | | - | |
514 | | - | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
515 | 542 | | |
| 543 | + | |
516 | 544 | | |
517 | 545 | | |
518 | 546 | | |
| |||
569 | 597 | | |
570 | 598 | | |
571 | 599 | | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
572 | 606 | | |
573 | 607 | | |
574 | 608 | | |
| |||
709 | 743 | | |
710 | 744 | | |
711 | 745 | | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
712 | 750 | | |
713 | 751 | | |
714 | 752 | | |
| |||
1378 | 1416 | | |
1379 | 1417 | | |
1380 | 1418 | | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
1381 | 1423 | | |
1382 | 1424 | | |
1383 | 1425 | | |
| |||
1759 | 1801 | | |
1760 | 1802 | | |
1761 | 1803 | | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
1762 | 1808 | | |
1763 | 1809 | | |
1764 | 1810 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
316 | 320 | | |
317 | 321 | | |
318 | 322 | | |
| |||
374 | 378 | | |
375 | 379 | | |
376 | 380 | | |
| 381 | + | |
| 382 | + | |
377 | 383 | | |
378 | 384 | | |
379 | 385 | | |
| |||
439 | 445 | | |
440 | 446 | | |
441 | 447 | | |
| 448 | + | |
| 449 | + | |
442 | 450 | | |
443 | 451 | | |
444 | 452 | | |
| |||
669 | 677 | | |
670 | 678 | | |
671 | 679 | | |
| 680 | + | |
| 681 | + | |
672 | 682 | | |
673 | 683 | | |
674 | 684 | | |
| |||
858 | 868 | | |
859 | 869 | | |
860 | 870 | | |
| 871 | + | |
| 872 | + | |
861 | 873 | | |
862 | 874 | | |
863 | 875 | | |
| |||
1322 | 1334 | | |
1323 | 1335 | | |
1324 | 1336 | | |
| 1337 | + | |
| 1338 | + | |
1325 | 1339 | | |
1326 | 1340 | | |
1327 | 1341 | | |
| |||
1840 | 1854 | | |
1841 | 1855 | | |
1842 | 1856 | | |
| 1857 | + | |
| 1858 | + | |
1843 | 1859 | | |
1844 | 1860 | | |
1845 | 1861 | | |
| |||
0 commit comments