@@ -13,10 +13,11 @@ func testSlowServer(slowServer: SlowServer) async throws {
13
13
// CHECK: [[METHOD:%.*]] = objc_method {{.*}} $@convention(objc_method) (NSString, @convention(block) (Int) -> (), SlowServer) -> ()
14
14
// CHECK: [[CONT:%.*]] = get_async_continuation_addr Int, [[RESUME_BUF]]
15
15
// CHECK: [[WRAPPED:%.*]] = struct $UnsafeContinuation<Int, Never> ([[CONT]] : $Builtin.RawUnsafeContinuation)
16
- // CHECK: [[BLOCK_STORAGE:%.*]] = alloc_stack $@block_storage UnsafeContinuation<Int, Never>
16
+ // CHECK: [[BLOCK_STORAGE:%.*]] = alloc_stack $@block_storage Any
17
17
// CHECK: [[CONT_SLOT:%.*]] = project_block_storage [[BLOCK_STORAGE]]
18
- // CHECK: store [[WRAPPED]] to [trivial] [[CONT_SLOT]]
19
- // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[INT_COMPLETION_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage UnsafeContinuation<Int, Never>, Int) -> ()
18
+ // CHECK: [[CONT_SLOT_ADDR:%.*]] = init_existential_addr [[CONT_SLOT]]
19
+ // CHECK: store [[WRAPPED]] to [trivial] [[CONT_SLOT_ADDR]]
20
+ // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[INT_COMPLETION_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage Any, Int) -> ()
20
21
// CHECK: [[BLOCK:%.*]] = init_block_storage_header [[BLOCK_STORAGE]] {{.*}}, invoke [[BLOCK_IMPL]]
21
22
// CHECK: apply [[METHOD]]([[ARG]], [[BLOCK]], %0)
22
23
// CHECK: [[COPY:%.*]] = copy_value [[ARG]]
@@ -35,10 +36,11 @@ func testSlowServer(slowServer: SlowServer) async throws {
35
36
// CHECK: [[METHOD:%.*]] = objc_method {{.*}} $@convention(objc_method) (@convention(block) (Optional<NSString>, Optional<NSError>) -> (), SlowServer) -> ()
36
37
// CHECK: [[CONT:%.*]] = get_async_continuation_addr [throws] String, [[RESUME_BUF]]
37
38
// CHECK: [[WRAPPED:%.*]] = struct $UnsafeContinuation<String, any Error> ([[CONT]] : $Builtin.RawUnsafeContinuation)
38
- // CHECK: [[BLOCK_STORAGE:%.*]] = alloc_stack $@block_storage UnsafeContinuation<String, any Error>
39
+ // CHECK: [[BLOCK_STORAGE:%.*]] = alloc_stack $@block_storage Any
39
40
// CHECK: [[CONT_SLOT:%.*]] = project_block_storage [[BLOCK_STORAGE]]
40
- // CHECK: store [[WRAPPED]] to [trivial] [[CONT_SLOT]]
41
- // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[STRING_COMPLETION_THROW_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage UnsafeContinuation<String, any Error>, Optional<NSString>, Optional<NSError>) -> ()
41
+ // CHECK: [[CONT_SLOT_ADDR:%.*]] = init_existential_addr [[CONT_SLOT]]
42
+ // CHECK: store [[WRAPPED]] to [trivial] [[CONT_SLOT_ADDR]]
43
+ // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[STRING_COMPLETION_THROW_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage Any, Optional<NSString>, Optional<NSError>) -> ()
42
44
// CHECK: [[BLOCK:%.*]] = init_block_storage_header [[BLOCK_STORAGE]] {{.*}}, invoke [[BLOCK_IMPL]]
43
45
// CHECK: apply [[METHOD]]([[BLOCK]], %0)
44
46
// CHECK: await_async_continuation [[CONT]] {{.*}}, resume [[RESUME:bb[0-9]+]], error [[ERROR:bb[0-9]+]]
@@ -49,17 +51,17 @@ func testSlowServer(slowServer: SlowServer) async throws {
49
51
let _: String = try await slowServer. findAnswer ( )
50
52
51
53
// CHECK: objc_method {{.*}} $@convention(objc_method) (NSString, @convention(block) () -> (), SlowServer) -> ()
52
- // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[VOID_COMPLETION_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage UnsafeContinuation<(), Never> ) -> ()
54
+ // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[VOID_COMPLETION_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage Any ) -> ()
53
55
await slowServer. serverRestart ( " somewhere " )
54
56
55
- // CHECK: function_ref @[[STRING_NONZERO_FLAG_THROW_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage UnsafeContinuation<String, any Error> , {{.*}}Bool, Optional<NSString>, Optional<NSError>) -> ()
57
+ // CHECK: function_ref @[[STRING_NONZERO_FLAG_THROW_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage Any , {{.*}}Bool, Optional<NSString>, Optional<NSError>) -> ()
56
58
let _: String = try await slowServer. doSomethingFlaggy ( )
57
- // CHECK: function_ref @[[STRING_ZERO_FLAG_THROW_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage UnsafeContinuation<String, any Error> , Optional<NSString>, {{.*}}Bool, Optional<NSError>) -> ()
59
+ // CHECK: function_ref @[[STRING_ZERO_FLAG_THROW_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage Any , Optional<NSString>, {{.*}}Bool, Optional<NSError>) -> ()
58
60
let _: String = try await slowServer. doSomethingZeroFlaggy ( )
59
- // CHECK: function_ref @[[STRING_STRING_ZERO_FLAG_THROW_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage UnsafeContinuation<(String, String), any Error> , {{.*}}Bool, Optional<NSString>, Optional<NSError>, Optional<NSString>) -> ()
61
+ // CHECK: function_ref @[[STRING_STRING_ZERO_FLAG_THROW_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage Any , {{.*}}Bool, Optional<NSString>, Optional<NSError>, Optional<NSString>) -> ()
60
62
let _: ( String , String ) = try await slowServer. doSomethingMultiResultFlaggy ( )
61
63
62
- // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[NSSTRING_INT_THROW_COMPLETION_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage UnsafeContinuation<(String, Int), any Error> , Optional<NSString>, Int, Optional<NSError>) -> ()
64
+ // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[NSSTRING_INT_THROW_COMPLETION_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage Any , Optional<NSString>, Int, Optional<NSError>) -> ()
63
65
let ( _, _) : ( String , Int ) = try await slowServer. findMultipleAnswers ( )
64
66
65
67
let ( _, _) : ( Bool , Bool ) = try await slowServer. findDifferentlyFlavoredBooleans ( )
@@ -103,7 +105,9 @@ func testGeneric2<T: AnyObject, U>(x: GenericObject<T>, y: U) async throws {
103
105
104
106
// CHECK: sil{{.*}}@[[INT_COMPLETION_BLOCK]]
105
107
// CHECK: [[CONT_ADDR:%.*]] = project_block_storage %0
106
- // CHECK: [[CONT:%.*]] = load [trivial] [[CONT_ADDR]]
108
+ // CHECK: [[CONT_OPEN_EXT:%.*]] = open_existential_addr immutable_access [[CONT_ADDR]]
109
+ // CHECK: [[CONT_CAST:%.*]] = unchecked_addr_cast [[CONT_OPEN_EXT]]
110
+ // CHECK: [[CONT:%.*]] = load [trivial] [[CONT_CAST]]
107
111
// CHECK: [[RESULT_BUF:%.*]] = alloc_stack $Int
108
112
// CHECK: store %1 to [trivial] [[RESULT_BUF]]
109
113
// CHECK: [[RESUME:%.*]] = function_ref @{{.*}}resumeUnsafeContinuation
@@ -113,7 +117,9 @@ func testGeneric2<T: AnyObject, U>(x: GenericObject<T>, y: U) async throws {
113
117
// CHECK: [[RESUME_IN:%.*]] = copy_value %1
114
118
// CHECK: [[ERROR_IN:%.*]] = copy_value %2
115
119
// CHECK: [[CONT_ADDR:%.*]] = project_block_storage %0
116
- // CHECK: [[CONT:%.*]] = load [trivial] [[CONT_ADDR]]
120
+ // CHECK: [[CONT_ADDR_OPENED:%.*]] = open_existential_addr immutable_access [[CONT_ADDR]]
121
+ // CHECK: [[CONT_ADDR_CAST:%.*]] = unchecked_addr_cast [[CONT_ADDR_OPENED]]
122
+ // CHECK: [[CONT:%.*]] = load [trivial] [[CONT_ADDR_CAST]]
117
123
// CHECK: [[ERROR_IN_B:%.*]] = begin_borrow [[ERROR_IN]]
118
124
// CHECK: switch_enum [[ERROR_IN_B]] : {{.*}}, case #Optional.some!enumelt: [[ERROR_BB:bb[0-9]+]], case #Optional.none!enumelt: [[RESUME_BB:bb[0-9]+]]
119
125
// CHECK: [[RESUME_BB]]:
@@ -136,7 +142,9 @@ func testGeneric2<T: AnyObject, U>(x: GenericObject<T>, y: U) async throws {
136
142
137
143
// CHECK: sil {{.*}} @[[VOID_COMPLETION_BLOCK]]
138
144
// CHECK: [[CONT_ADDR:%.*]] = project_block_storage %0
139
- // CHECK: [[CONT:%.*]] = load [trivial] [[CONT_ADDR]]
145
+ // CHECK: [[CONT_OPEN:%.*]] = open_existential_addr immutable_access [[CONT_ADDR]]
146
+ // CHECK: [[CONT_CAST:%.*]] = unchecked_addr_cast [[CONT_OPEN]]
147
+ // CHECK: [[CONT:%.*]] = load [trivial] [[CONT_CAST]]
140
148
// CHECK: [[RESULT_BUF:%.*]] = alloc_stack $()
141
149
// CHECK: [[RESUME:%.*]] = function_ref @{{.*}}resumeUnsafeContinuation
142
150
// CHECK: apply [[RESUME]]<()>([[CONT]], [[RESULT_BUF]])
@@ -184,10 +192,11 @@ func testSlowServerFromMain(slowServer: SlowServer) async throws {
184
192
// CHECK: [[METHOD:%.*]] = objc_method {{.*}} $@convention(objc_method) (NSString, @convention(block) (Int) -> (), SlowServer) -> ()
185
193
// CHECK: [[CONT:%.*]] = get_async_continuation_addr Int, [[RESUME_BUF]]
186
194
// CHECK: [[WRAPPED:%.*]] = struct $UnsafeContinuation<Int, Never> ([[CONT]] : $Builtin.RawUnsafeContinuation)
187
- // CHECK: [[BLOCK_STORAGE:%.*]] = alloc_stack $@block_storage UnsafeContinuation<Int, Never>
195
+ // CHECK: [[BLOCK_STORAGE:%.*]] = alloc_stack $@block_storage Any
188
196
// CHECK: [[CONT_SLOT:%.*]] = project_block_storage [[BLOCK_STORAGE]]
189
- // CHECK: store [[WRAPPED]] to [trivial] [[CONT_SLOT]]
190
- // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[INT_COMPLETION_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage UnsafeContinuation<Int, Never>, Int) -> ()
197
+ // CHECK: [[CONT_SLOT_ANY:%.*]] = init_existential_addr [[CONT_SLOT]]
198
+ // CHECK: store [[WRAPPED]] to [trivial] [[CONT_SLOT_ANY]]
199
+ // CHECK: [[BLOCK_IMPL:%.*]] = function_ref @[[INT_COMPLETION_BLOCK:.*]] : $@convention(c) (@inout_aliasable @block_storage Any, Int) -> ()
191
200
// CHECK: [[BLOCK:%.*]] = init_block_storage_header [[BLOCK_STORAGE]] {{.*}}, invoke [[BLOCK_IMPL]]
192
201
// CHECK: apply [[METHOD]]([[ARG]], [[BLOCK]], %0)
193
202
// CHECK: [[COPY:%.*]] = copy_value [[ARG]]
@@ -210,15 +219,16 @@ func testThrowingMethodFromMain(slowServer: SlowServer) async -> String {
210
219
// CHECK: [[METH:%.*]] = objc_method {{%.*}} : $SlowServer, #SlowServer.doSomethingDangerous!foreign
211
220
// CHECK: [[RAW_CONT:%.*]] = get_async_continuation_addr [throws] String, [[RESULT_BUF]] : $*String
212
221
// CHECK: [[CONT:%.*]] = struct $UnsafeContinuation<String, any Error> ([[RAW_CONT]] : $Builtin.RawUnsafeContinuation)
213
- // CHECK: [[STORE_ALLOC:%.*]] = alloc_stack $@block_storage UnsafeContinuation<String, any Error>
222
+ // CHECK: [[STORE_ALLOC:%.*]] = alloc_stack $@block_storage Any
214
223
// CHECK: [[PROJECTED:%.*]] = project_block_storage [[STORE_ALLOC]] : $*@block_storage
215
- // CHECK: store [[CONT]] to [trivial] [[PROJECTED]] : $*UnsafeContinuation<String, any Error>
224
+ // CHECK: [[PROJECTED_ANY:%.*]] = init_existential_addr [[PROJECTED]]
225
+ // CHECK: store [[CONT]] to [trivial] [[PROJECTED_ANY]]
216
226
// CHECK: [[INVOKER:%.*]] = function_ref @$sSo8NSStringCSgSo7NSErrorCSgIeyByy_SSTz_
217
227
// CHECK: [[BLOCK:%.*]] = init_block_storage_header [[STORE_ALLOC]] {{.*}}, invoke [[INVOKER]]
218
228
// CHECK: [[OPTIONAL_BLK:%.*]] = enum {{.*}}, #Optional.some!enumelt, [[BLOCK]]
219
- // CHECK: %28 = apply [[METH]]([[STRING_ARG]], [[OPTIONAL_BLK]], {{%.*}}) : $@convention(objc_method) (NSString, Optional<@convention(block) (Optional<NSString>, Optional<NSError>) -> ()>, SlowServer) -> ()
229
+ // CHECK: apply [[METH]]([[STRING_ARG]], [[OPTIONAL_BLK]], {{%.*}}) : $@convention(objc_method) (NSString, Optional<@convention(block) (Optional<NSString>, Optional<NSError>) -> ()>, SlowServer) -> ()
220
230
// CHECK: [[STRING_ARG_COPY:%.*]] = copy_value [[STRING_ARG]] : $NSString
221
- // CHECK: dealloc_stack [[STORE_ALLOC]] : $*@block_storage UnsafeContinuation<String, any Error>
231
+ // CHECK: dealloc_stack [[STORE_ALLOC]] : $*@block_storage Any
222
232
// CHECK: destroy_value [[STRING_ARG]] : $NSString
223
233
// CHECK: await_async_continuation [[RAW_CONT]] : $Builtin.RawUnsafeContinuation, resume [[RESUME:bb[0-9]+]], error [[ERROR:bb[0-9]+]]
224
234
@@ -288,11 +298,12 @@ extension OptionalMemberLookups {
288
298
// CHECK: [[SELF:%[0-9]+]] = copy_value {{.*}} : $Self
289
299
// CHECK: [[METH:%[0-9]+]] = objc_method {{.*}} : $Self, #OptionalMemberLookups.generateMaybe!foreign : <Self where Self : OptionalMemberLookups> (Self) -> () async -> (), $@convention(objc_method) (@convention(block) () -> (), Self) -> ()
290
300
// CHECK: [[CONT:%.*]] = struct $UnsafeContinuation<(), Never> (%10 : $Builtin.RawUnsafeContinuation)
291
- // CHECK: [[BLOCK_STORAGE:%.*]] = alloc_stack $@block_storage UnsafeContinuation<(), Never>
292
- // CHECK: [[PROJECTED:%.*]] = project_block_storage [[BLOCK_STORAGE]] : $*@block_storage UnsafeContinuation<(), Never>
293
- // CHECK: store [[CONT]] to [trivial] [[PROJECTED]] : $*UnsafeContinuation<(), Never>
294
- // CHECK: = function_ref @$sIeyB_yt10objc_async21OptionalMemberLookupsRzlTz_ : $@convention(c) @pseudogeneric <τ_0_0 where τ_0_0 : OptionalMemberLookups> (@inout_aliasable @block_storage UnsafeContinuation<(), Never>) -> ()
295
- // CHECK: [[BLOCK:%[0-9]+]] = init_block_storage_header {{.*}} : $*@block_storage UnsafeContinuation<(), Never>
301
+ // CHECK: [[BLOCK_STORAGE:%.*]] = alloc_stack $@block_storage
302
+ // CHECK: [[PROJECTED:%.*]] = project_block_storage [[BLOCK_STORAGE]] : $*@block_storage
303
+ // CHECK: [[PROJECTED_ANY:%.*]] = init_existential_addr [[PROJECTED]]
304
+ // CHECK: store [[CONT]] to [trivial] [[PROJECTED_ANY]]
305
+ // CHECK: = function_ref @$sIeyB_yt10objc_async21OptionalMemberLookupsRzlTz_ : $@convention(c) @pseudogeneric <τ_0_0 where τ_0_0 : OptionalMemberLookups> (@inout_aliasable @block_storage Any) -> ()
306
+ // CHECK: [[BLOCK:%[0-9]+]] = init_block_storage_header {{.*}} : $*@block_storage
296
307
// CHECK: = apply [[METH]]([[BLOCK]], [[SELF]]) : $@convention(objc_method) (@convention(block) () -> (), Self) -> ()
297
308
// CHECK: await_async_continuation {{.*}} : $Builtin.RawUnsafeContinuation, resume bb1
298
309
// CHECK: hop_to_executor {{.*}} : $MainActor
0 commit comments