Commit 8544164
committed
[LoopVectorize] Don't scalarize predicated instruction with optsize
Scalarizing predicated instructions results in a worse code size
impact than having a scalar epilogue, which we already forbid with
optsize, so we shouldn't allow it.
A couple of notes on the implementation:
* OptForSizeBasedOnProfile has been moved into the cost model and
renamed to OptForSize, as shouldOptimizeForSize checks both the
function attribute and profile.
* We still allow tail folding if we don't need to scalarize any
instructions, e.g. see foo_optsize in the test
Transforms/LoopVectorize/X86/optsize.ll.
This change requires a lot of test changes. Where a test is
specifically testing scalarized predicated instructions I've adjusted
it so it still does, either by removing optsize if it makes no
difference or forcing tail predication to be enabled. For tests of
optsize I've updated the test to check we're not scalarizing.
Fixes #666521 parent 2639dea commit 8544164
File tree
16 files changed
+202
-802
lines changed- llvm
- lib/Transforms/Vectorize
- test/Transforms/LoopVectorize
- AArch64
- ARM
- X86
16 files changed
+202
-802
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
491 | 491 | | |
492 | 492 | | |
493 | 493 | | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
| 494 | + | |
500 | 495 | | |
501 | 496 | | |
502 | 497 | | |
| |||
669 | 664 | | |
670 | 665 | | |
671 | 666 | | |
672 | | - | |
673 | | - | |
674 | | - | |
675 | | - | |
676 | 667 | | |
677 | 668 | | |
678 | 669 | | |
| |||
986 | 977 | | |
987 | 978 | | |
988 | 979 | | |
989 | | - | |
| 980 | + | |
| 981 | + | |
990 | 982 | | |
991 | 983 | | |
992 | 984 | | |
993 | 985 | | |
994 | 986 | | |
995 | 987 | | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
996 | 992 | | |
997 | 993 | | |
998 | 994 | | |
| |||
1833 | 1829 | | |
1834 | 1830 | | |
1835 | 1831 | | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
1836 | 1836 | | |
1837 | 1837 | | |
1838 | 1838 | | |
| |||
2612 | 2612 | | |
2613 | 2613 | | |
2614 | 2614 | | |
2615 | | - | |
2616 | | - | |
2617 | | - | |
| 2615 | + | |
| 2616 | + | |
2618 | 2617 | | |
2619 | 2618 | | |
2620 | 2619 | | |
| |||
2639 | 2638 | | |
2640 | 2639 | | |
2641 | 2640 | | |
2642 | | - | |
| 2641 | + | |
2643 | 2642 | | |
2644 | 2643 | | |
2645 | 2644 | | |
| |||
5518 | 5517 | | |
5519 | 5518 | | |
5520 | 5519 | | |
| 5520 | + | |
| 5521 | + | |
| 5522 | + | |
5521 | 5523 | | |
5522 | 5524 | | |
5523 | 5525 | | |
| |||
5660 | 5662 | | |
5661 | 5663 | | |
5662 | 5664 | | |
| 5665 | + | |
| 5666 | + | |
| 5667 | + | |
| 5668 | + | |
| 5669 | + | |
| 5670 | + | |
| 5671 | + | |
5663 | 5672 | | |
5664 | 5673 | | |
5665 | 5674 | | |
| |||
10090 | 10099 | | |
10091 | 10100 | | |
10092 | 10101 | | |
10093 | | - | |
| 10102 | + | |
10094 | 10103 | | |
10095 | 10104 | | |
10096 | 10105 | | |
| |||
10627 | 10636 | | |
10628 | 10637 | | |
10629 | 10638 | | |
10630 | | - | |
| 10639 | + | |
10631 | 10640 | | |
10632 | 10641 | | |
10633 | 10642 | | |
| |||
Lines changed: 11 additions & 37 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1588 | 1588 | | |
1589 | 1589 | | |
1590 | 1590 | | |
1591 | | - | |
| 1591 | + | |
1592 | 1592 | | |
1593 | | - | |
| 1593 | + | |
1594 | 1594 | | |
1595 | 1595 | | |
1596 | 1596 | | |
1597 | 1597 | | |
1598 | 1598 | | |
1599 | | - | |
1600 | | - | |
1601 | | - | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
1602 | 1602 | | |
1603 | 1603 | | |
1604 | | - | |
1605 | | - | |
1606 | | - | |
1607 | | - | |
1608 | | - | |
1609 | | - | |
1610 | | - | |
1611 | | - | |
1612 | | - | |
1613 | | - | |
1614 | | - | |
1615 | | - | |
1616 | | - | |
1617 | | - | |
1618 | | - | |
1619 | | - | |
1620 | | - | |
1621 | | - | |
1622 | | - | |
1623 | | - | |
1624 | | - | |
1625 | | - | |
1626 | | - | |
1627 | | - | |
1628 | 1604 | | |
1629 | 1605 | | |
1630 | | - | |
1631 | | - | |
1632 | | - | |
| 1606 | + | |
1633 | 1607 | | |
1634 | | - | |
1635 | | - | |
| 1608 | + | |
| 1609 | + | |
1636 | 1610 | | |
1637 | | - | |
| 1611 | + | |
1638 | 1612 | | |
1639 | | - | |
| 1613 | + | |
1640 | 1614 | | |
1641 | 1615 | | |
1642 | 1616 | | |
| |||
1653 | 1627 | | |
1654 | 1628 | | |
1655 | 1629 | | |
1656 | | - | |
| 1630 | + | |
1657 | 1631 | | |
1658 | 1632 | | |
1659 | 1633 | | |
| |||
0 commit comments