Commit 198685c
committed
[region-isolation] Make store_borrow a store operation that does not require.
TLDR:
The reason why I am doing this is it ensures that temporary store_borrow that we
create when materializing a value before were treated as uses. So we would error
on this:
```swift
@mainactor func transferToMain<T>(_ t: T) async {}
func test() async {
let x = NonSendableKlass()
await transferToMain(x)
await transferToMain(x)
}
```
----
store_borrow is an instruction intended to be used to initialize temporary
alloc_stack with borrows. Since it is a temporary, we do not want to error on
the temporaries initialization... instead, we want to error on the use of the
temporary parameter.
This is achieved by making it so that store_borrow still performs an
assign/merge, but does not require that src/dest be alive. So the regions still
merge (yielding diagnostics for later uses).
It also required me to make it so that PartitionOp::{Assign,Merge} do not
require by default. Instead, we want the individual operations to always emit a
PartitionOp::Require explicitly (which they already did).
One thing to be aware of is that when it comes to diagnostics, we already know
how to find a temporaries original value and how to handle that. So this is the
last part of making store_borrow behave nicely.
rdar://129237675
(cherry-picked from commit bd472b1)1 parent e58b7a3 commit 198685c
File tree
4 files changed
+85
-46
lines changed- include/swift/SILOptimizer/Utils
- lib/SILOptimizer/Analysis
- test/Concurrency
4 files changed
+85
-46
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1057 | 1057 | | |
1058 | 1058 | | |
1059 | 1059 | | |
1060 | | - | |
1061 | | - | |
1062 | | - | |
1063 | | - | |
1064 | | - | |
1065 | | - | |
1066 | | - | |
1067 | | - | |
1068 | 1060 | | |
1069 | 1061 | | |
1070 | 1062 | | |
| |||
1154 | 1146 | | |
1155 | 1147 | | |
1156 | 1148 | | |
1157 | | - | |
1158 | | - | |
1159 | | - | |
1160 | | - | |
1161 | | - | |
1162 | | - | |
1163 | | - | |
1164 | | - | |
1165 | | - | |
1166 | | - | |
1167 | | - | |
1168 | | - | |
1169 | | - | |
1170 | | - | |
1171 | 1149 | | |
1172 | 1150 | | |
1173 | 1151 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1606 | 1606 | | |
1607 | 1607 | | |
1608 | 1608 | | |
1609 | | - | |
| 1609 | + | |
| 1610 | + | |
1610 | 1611 | | |
1611 | 1612 | | |
1612 | 1613 | | |
| |||
1672 | 1673 | | |
1673 | 1674 | | |
1674 | 1675 | | |
1675 | | - | |
1676 | | - | |
1677 | | - | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
| 1679 | + | |
| 1680 | + | |
| 1681 | + | |
| 1682 | + | |
| 1683 | + | |
| 1684 | + | |
| 1685 | + | |
| 1686 | + | |
1678 | 1687 | | |
1679 | 1688 | | |
1680 | 1689 | | |
| |||
2136 | 2145 | | |
2137 | 2146 | | |
2138 | 2147 | | |
2139 | | - | |
| 2148 | + | |
| 2149 | + | |
2140 | 2150 | | |
2141 | 2151 | | |
2142 | 2152 | | |
2143 | 2153 | | |
2144 | 2154 | | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
2145 | 2159 | | |
2146 | 2160 | | |
2147 | 2161 | | |
2148 | 2162 | | |
2149 | 2163 | | |
2150 | 2164 | | |
2151 | 2165 | | |
2152 | | - | |
2153 | | - | |
| 2166 | + | |
| 2167 | + | |
| 2168 | + | |
| 2169 | + | |
2154 | 2170 | | |
2155 | 2171 | | |
2156 | 2172 | | |
| |||
2641 | 2657 | | |
2642 | 2658 | | |
2643 | 2659 | | |
2644 | | - | |
2645 | 2660 | | |
2646 | 2661 | | |
2647 | 2662 | | |
| |||
2895 | 2910 | | |
2896 | 2911 | | |
2897 | 2912 | | |
| 2913 | + | |
| 2914 | + | |
| 2915 | + | |
| 2916 | + | |
| 2917 | + | |
| 2918 | + | |
| 2919 | + | |
| 2920 | + | |
| 2921 | + | |
| 2922 | + | |
| 2923 | + | |
| 2924 | + | |
| 2925 | + | |
| 2926 | + | |
| 2927 | + | |
| 2928 | + | |
| 2929 | + | |
| 2930 | + | |
| 2931 | + | |
| 2932 | + | |
| 2933 | + | |
| 2934 | + | |
| 2935 | + | |
| 2936 | + | |
| 2937 | + | |
| 2938 | + | |
| 2939 | + | |
| 2940 | + | |
| 2941 | + | |
| 2942 | + | |
| 2943 | + | |
| 2944 | + | |
| 2945 | + | |
| 2946 | + | |
| 2947 | + | |
| 2948 | + | |
| 2949 | + | |
| 2950 | + | |
2898 | 2951 | | |
2899 | 2952 | | |
2900 | 2953 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
17 | | - | |
| 17 | + | |
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| |||
1825 | 1825 | | |
1826 | 1826 | | |
1827 | 1827 | | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
40 | 47 | | |
41 | 48 | | |
42 | 49 | | |
| |||
52 | 59 | | |
53 | 60 | | |
54 | 61 | | |
| 62 | + | |
55 | 63 | | |
56 | 64 | | |
57 | 65 | | |
| |||
69 | 77 | | |
70 | 78 | | |
71 | 79 | | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | 80 | | |
82 | 81 | | |
83 | 82 | | |
| |||
294 | 293 | | |
295 | 294 | | |
296 | 295 | | |
297 | | - | |
298 | | - | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
299 | 299 | | |
300 | 300 | | |
301 | 301 | | |
302 | | - | |
303 | | - | |
304 | | - | |
| 302 | + | |
305 | 303 | | |
306 | 304 | | |
307 | 305 | | |
| |||
314 | 312 | | |
315 | 313 | | |
316 | 314 | | |
317 | | - | |
| 315 | + | |
318 | 316 | | |
319 | 317 | | |
320 | 318 | | |
| |||
0 commit comments