@@ -521,3 +521,38 @@ entry:
521521 %t = tuple ()
522522 return %t : $()
523523}
524+
525+ sil [ossa] @asyncIntClosure : $@convention(thin) @async (@inout_aliasable Builtin.Int64) -> (@out Builtin.Int64, @error any Error) {
526+ bb0(%0 : $*Builtin.Int64, %1: $*Builtin.Int64):
527+ %2 = begin_access [modify] [unknown] %0 : $*Builtin.Int64
528+ %3 = load [trivial] %1 : $*Builtin.Int64
529+ assign %3 to %2 : $*Builtin.Int64
530+ end_access %2 : $*Builtin.Int64
531+ %4 = tuple ()
532+ return %4 : $()
533+ }
534+
535+ sil @swift_asyncLet_finish : $@convention(thin) @async (Builtin.RawPointer, Builtin.RawPointer) -> ()
536+
537+ // CHECK-LABEL: @partial_apply_asynclet
538+ sil [ossa] @partial_apply_asynclet : $@convention(thin) @async (@inout_aliasable Builtin.Int64) -> () {
539+ bb0(%0 : $*Builtin.Int64):
540+ %i = alloc_stack $Builtin.Int64
541+ %p = address_to_pointer %i : $*Builtin.Int64 to $Builtin.RawPointer
542+ %o = enum $Optional<Builtin.RawPointer>, #Optional.none!enumelt
543+ %x = enum $Optional<Builtin.Executor>, #Optional.none!enumelt
544+ %f = function_ref @asyncIntClosure : $@convention(thin) @async (@inout_aliasable Builtin.Int64) -> (@out Builtin.Int64, @error any Error)
545+ %e = partial_apply [callee_guaranteed] %f(%0) : $@convention(thin) @async (@inout_aliasable Builtin.Int64) -> (@out Builtin.Int64, @error any Error)
546+ %a = convert_function %e : $@async @callee_guaranteed () -> (@out Builtin.Int64, @error any Error) to $@async @callee_guaranteed @substituted <τ_0_0> () -> (@sil_sending @out τ_0_0, @error any Error) for <Builtin.Int64>
547+ %n = convert_escape_to_noescape [not_guaranteed] %a : $@async @callee_guaranteed @substituted <τ_0_0> () -> (@sil_sending @out τ_0_0, @error any Error) for <Builtin.Int64> to $@noescape @async @callee_guaranteed @substituted <τ_0_0> () -> (@sil_sending @out τ_0_0, @error any Error) for <Builtin.Int64>
548+ %sl = builtin "startAsyncLetWithLocalBuffer"<Builtin.Int64>(%o : $Optional<Builtin.RawPointer>, %n : $@noescape @async @callee_guaranteed @substituted <τ_0_0> () -> (@sil_sending @out τ_0_0, @error any Error) for <Builtin.Int64>, %p : $Builtin.RawPointer) : $Builtin.RawPointer
549+ %fn = function_ref @swift_asyncLet_finish : $@convention(thin) @async (Builtin.RawPointer, Builtin.RawPointer) -> ()
550+ %ap = apply %fn(%sl, %p) : $@convention(thin) @async (Builtin.RawPointer, Builtin.RawPointer) -> ()
551+ hop_to_executor %x : $Optional<Builtin.Executor>
552+ %el = builtin "endAsyncLetLifetime"(%sl : $Builtin.RawPointer) : $()
553+ destroy_value %n : $@noescape @async @callee_guaranteed @substituted <τ_0_0> () -> (@sil_sending @out τ_0_0, @error any Error) for <Builtin.Int64>
554+ destroy_value %a : $@async @callee_guaranteed @substituted <τ_0_0> () -> (@sil_sending @out τ_0_0, @error any Error) for <Builtin.Int64>
555+ dealloc_stack %i : $*Builtin.Int64
556+ %t = tuple ()
557+ return %t : $()
558+ }
0 commit comments