Commit bfd4155
authored
[VPlan] Don't apply predication discount to non-originally-predicated blocks (#160449)
Split off from #158690. Currently if an instruction needs predicated due
to tail folding, it will also have a predicated discount applied to it
in multiple places.
This is likely inaccurate because we can expect a tail folded
instruction to be executed on every iteration bar the last.
This fixes it by checking if the instruction/block was originally
predicated, and in doing so prevents vectorization with tail folding
where we would have had to scalarize the memory op anyway.
On llvm-test-suite this causes 4 loops in total to no longer be
vectorized with -O3 on arm64-apple-darwin, and there's no observable
performance impact.1 parent 1ffe79d commit bfd4155
File tree
10 files changed
+134
-567
lines changed- llvm
- lib/Transforms/Vectorize
- test/Transforms/LoopVectorize
- AArch64
- ARM
- X86
- CostModel
10 files changed
+134
-567
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1232 | 1232 | | |
1233 | 1233 | | |
1234 | 1234 | | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
1235 | 1259 | | |
1236 | 1260 | | |
1237 | 1261 | | |
| |||
2887 | 2911 | | |
2888 | 2912 | | |
2889 | 2913 | | |
2890 | | - | |
| 2914 | + | |
| 2915 | + | |
2891 | 2916 | | |
2892 | 2917 | | |
2893 | 2918 | | |
| |||
5032 | 5057 | | |
5033 | 5058 | | |
5034 | 5059 | | |
5035 | | - | |
| 5060 | + | |
5036 | 5061 | | |
5037 | 5062 | | |
5038 | 5063 | | |
| |||
5082 | 5107 | | |
5083 | 5108 | | |
5084 | 5109 | | |
5085 | | - | |
5086 | | - | |
5087 | | - | |
5088 | | - | |
| 5110 | + | |
| 5111 | + | |
| 5112 | + | |
| 5113 | + | |
| 5114 | + | |
5089 | 5115 | | |
5090 | 5116 | | |
5091 | 5117 | | |
| |||
5164 | 5190 | | |
5165 | 5191 | | |
5166 | 5192 | | |
5167 | | - | |
| 5193 | + | |
5168 | 5194 | | |
5169 | 5195 | | |
5170 | 5196 | | |
| |||
6732 | 6758 | | |
6733 | 6759 | | |
6734 | 6760 | | |
| 6761 | + | |
| 6762 | + | |
| 6763 | + | |
| 6764 | + | |
6735 | 6765 | | |
6736 | 6766 | | |
6737 | 6767 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | 53 | | |
69 | 54 | | |
70 | 55 | | |
| |||
367 | 352 | | |
368 | 353 | | |
369 | 354 | | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
370 | 359 | | |
371 | 360 | | |
372 | 361 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3349 | 3349 | | |
3350 | 3350 | | |
3351 | 3351 | | |
3352 | | - | |
| 3352 | + | |
3353 | 3353 | | |
3354 | 3354 | | |
3355 | 3355 | | |
| |||
Lines changed: 10 additions & 56 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
613 | 613 | | |
614 | 614 | | |
615 | 615 | | |
616 | | - | |
617 | | - | |
618 | | - | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
626 | | - | |
627 | | - | |
628 | | - | |
629 | | - | |
630 | | - | |
631 | | - | |
632 | | - | |
633 | | - | |
634 | | - | |
635 | | - | |
636 | | - | |
637 | | - | |
638 | | - | |
639 | | - | |
640 | | - | |
641 | | - | |
642 | | - | |
643 | | - | |
644 | | - | |
645 | | - | |
646 | | - | |
647 | | - | |
648 | | - | |
649 | | - | |
650 | | - | |
651 | | - | |
652 | | - | |
653 | | - | |
654 | | - | |
655 | | - | |
656 | | - | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
661 | | - | |
662 | | - | |
663 | | - | |
664 | | - | |
665 | | - | |
666 | | - | |
667 | | - | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
668 | 626 | | |
669 | | - | |
670 | | - | |
671 | | - | |
672 | | - | |
673 | 627 | | |
674 | 628 | | |
675 | 629 | | |
| |||
0 commit comments