Commit 0107028
committed
Resume inlining globals across crates
In #8185 cross-crate condition handlers were fixed by ensuring that globals
didn't start appearing in different crates with different addressed. An
unfortunate side effect of that pull request is that constants weren't inlined
across crates (uint::bits is unknown to everything but libstd).
This commit fixes this inlining by using the `available_eternally` linkage
provided by LLVM. It partially reverts #8185, and then adds support for this
linkage type. The main caveat is that not all statics could be inlined into
other crates. Before this patch, all statics were considered "inlineable items",
but an unfortunate side effect of how we deal with `&static` and `&[static]`
means that these two cases cannot be inlined across crates. The translation of
constants was modified to propogate this condition of whether a constant
should be considered inlineable into other crates.
Closes #90361 parent 3e1803f commit 0107028
File tree
9 files changed
+157
-59
lines changed- src
- librustc
- metadata
- middle/trans
- test
- auxiliary
- run-pass
9 files changed
+157
-59
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
| 93 | + | |
92 | 94 | | |
93 | 95 | | |
94 | 96 | | |
| |||
907 | 909 | | |
908 | 910 | | |
909 | 911 | | |
910 | | - | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
911 | 915 | | |
912 | 916 | | |
913 | 917 | | |
| |||
1728 | 1732 | | |
1729 | 1733 | | |
1730 | 1734 | | |
| 1735 | + | |
1731 | 1736 | | |
1732 | 1737 | | |
1733 | 1738 | | |
| |||
1739 | 1744 | | |
1740 | 1745 | | |
1741 | 1746 | | |
| 1747 | + | |
1742 | 1748 | | |
1743 | 1749 | | |
1744 | 1750 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
324 | 324 | | |
325 | 325 | | |
326 | 326 | | |
327 | | - | |
| 327 | + | |
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
335 | | - | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
336 | 337 | | |
337 | 338 | | |
338 | 339 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2494 | 2494 | | |
2495 | 2495 | | |
2496 | 2496 | | |
2497 | | - | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
2498 | 2511 | | |
2499 | 2512 | | |
2500 | | - | |
| 2513 | + | |
2501 | 2514 | | |
2502 | | - | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
2503 | 2520 | | |
2504 | 2521 | | |
2505 | 2522 | | |
| |||
2950 | 2967 | | |
2951 | 2968 | | |
2952 | 2969 | | |
| 2970 | + | |
2953 | 2971 | | |
2954 | 2972 | | |
2955 | 2973 | | |
| |||
0 commit comments