Commit 90d05c1
committed
Lazily Associated a SILRemarkStreamer with an LLVMContext at IRGen time
Corrects a mistake introduced in #31106
I was under the impression that the LLVMContext for an instance of
llvm::remarks::RemarkStreamer was somehow just scratch-space. It turns
out the ASMPrinters don't gather remarks data from modules, they gather
it from the remark streamer associated with the module's context.
Thus, we cannot have the module's context be distinct from whatever
context the streamer is eventually associated with.
In order to bring these two systems back into harmony, introduce a simple
ownership contract to SILRemarkStreamer. That is, it starts owned by
a SILModule, in which case the SILRemarkStreamer holds onto the
underlying LLVM object as the optimizer emits remarks. When it comes
time to IRGen the module, then and only then do we install the streamer
on the module's context. This tranfers ownership of the underlying LLVM
streamer to LLVM itself, so it acts as a consuming operation. When we
are about to perform IR Generation, the SILModule will be expiring
anyways, so the streamer was already about to be destroyed.
We're just putting it to better use doing its job.1 parent 477af9f commit 90d05c1
File tree
5 files changed
+41
-16
lines changed- include/swift/SIL
- lib
- IRGen
- SIL/Utils
- test/Driver
5 files changed
+41
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
523 | 523 | | |
524 | 524 | | |
525 | 525 | | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
526 | 529 | | |
527 | 530 | | |
528 | 531 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
30 | | - | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
31 | 34 | | |
32 | 35 | | |
33 | 36 | | |
| |||
53 | 56 | | |
54 | 57 | | |
55 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
56 | 65 | | |
57 | 66 | | |
58 | 67 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| |||
884 | 885 | | |
885 | 886 | | |
886 | 887 | | |
887 | | - | |
| 888 | + | |
888 | 889 | | |
889 | 890 | | |
890 | 891 | | |
| |||
902 | 903 | | |
903 | 904 | | |
904 | 905 | | |
905 | | - | |
906 | | - | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
907 | 909 | | |
908 | 910 | | |
909 | 911 | | |
910 | 912 | | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
911 | 917 | | |
912 | 918 | | |
913 | 919 | | |
| |||
926 | 932 | | |
927 | 933 | | |
928 | 934 | | |
929 | | - | |
| 935 | + | |
930 | 936 | | |
931 | 937 | | |
932 | 938 | | |
| |||
969 | 975 | | |
970 | 976 | | |
971 | 977 | | |
972 | | - | |
| 978 | + | |
973 | 979 | | |
974 | 980 | | |
975 | 981 | | |
| |||
1217 | 1223 | | |
1218 | 1224 | | |
1219 | 1225 | | |
1220 | | - | |
| 1226 | + | |
1221 | 1227 | | |
1222 | 1228 | | |
1223 | 1229 | | |
| |||
1431 | 1437 | | |
1432 | 1438 | | |
1433 | 1439 | | |
1434 | | - | |
| 1440 | + | |
1435 | 1441 | | |
1436 | 1442 | | |
1437 | 1443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
| 22 | + | |
| 23 | + | |
26 | 24 | | |
27 | 25 | | |
28 | | - | |
| 26 | + | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
32 | 30 | | |
33 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
7 | 12 | | |
8 | 13 | | |
9 | 14 | | |
| |||
0 commit comments