Commit 1cea5c2
authored
[SCCP] Propagate non-null pointers (#106090)
Add NotConstant(Null) roots for nonnull arguments and then propagate
them through nuw/inbounds GEPs.
Having this functionality in SCCP is useful because it allows reliably
eliminating null comparisons, independently of how deeply nested they
are in selects/phis. This handles cases that would hit a cutoff in
ValueTracking otherwise.
The implementation is something of a MVP, there are a number of obvious
extensions (e.g. allocas are also non-null).1 parent 0ef8e71 commit 1cea5c2
File tree
2 files changed
+40
-15
lines changed- llvm
- lib/Transforms/Utils
- test/Transforms/SCCP
2 files changed
+40
-15
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
449 | 455 | | |
450 | 456 | | |
451 | 457 | | |
| |||
820 | 826 | | |
821 | 827 | | |
822 | 828 | | |
823 | | - | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
824 | 834 | | |
825 | 835 | | |
826 | 836 | | |
| |||
905 | 915 | | |
906 | 916 | | |
907 | 917 | | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
908 | 927 | | |
909 | 928 | | |
910 | 929 | | |
| |||
1574 | 1593 | | |
1575 | 1594 | | |
1576 | 1595 | | |
| 1596 | + | |
| 1597 | + | |
| 1598 | + | |
| 1599 | + | |
| 1600 | + | |
| 1601 | + | |
| 1602 | + | |
| 1603 | + | |
| 1604 | + | |
| 1605 | + | |
| 1606 | + | |
| 1607 | + | |
| 1608 | + | |
1577 | 1609 | | |
1578 | 1610 | | |
1579 | 1611 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
18 | | - | |
| 17 | + | |
19 | 18 | | |
20 | 19 | | |
21 | 20 | | |
| |||
24 | 23 | | |
25 | 24 | | |
26 | 25 | | |
27 | | - | |
28 | | - | |
| 26 | + | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| |||
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
37 | | - | |
38 | | - | |
| 35 | + | |
39 | 36 | | |
40 | 37 | | |
41 | 38 | | |
| |||
57 | 54 | | |
58 | 55 | | |
59 | 56 | | |
60 | | - | |
61 | | - | |
| 57 | + | |
62 | 58 | | |
63 | 59 | | |
64 | 60 | | |
| |||
69 | 65 | | |
70 | 66 | | |
71 | 67 | | |
72 | | - | |
73 | | - | |
| 68 | + | |
74 | 69 | | |
75 | 70 | | |
76 | 71 | | |
| |||
94 | 89 | | |
95 | 90 | | |
96 | 91 | | |
97 | | - | |
98 | | - | |
| 92 | + | |
99 | 93 | | |
100 | 94 | | |
101 | 95 | | |
| |||
127 | 121 | | |
128 | 122 | | |
129 | 123 | | |
130 | | - | |
131 | | - | |
| 124 | + | |
132 | 125 | | |
133 | 126 | | |
134 | 127 | | |
| |||
0 commit comments