Skip to content

Commit 61c12e4

Browse files
committed
Fix LoadableByAddress to use @in_guaranteed for unowned values
LoadableByAddress was accidentally changing ownership of direct_unowned values to @in (owned). This generates unsupported SIL for on-stack partial applies, which now breaks SIL verification. This also resulted in extra copies of values inside of closure contexts. Before calling the original function, the value would need to be copied onto the stack and the context would be destroyed. Now, we simply pass a pointer directly from the closure context. See IRGen/indirect_argument.sil+huge_partial_application. I'm pretty sure fixing this has no effect on the mangling of public symbols.
1 parent a533c63 commit 61c12e4

8 files changed

+74
-42
lines changed

lib/IRGen/LoadableByAddress.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,14 +402,16 @@ SILParameterInfo LargeSILTypeMapper::getNewParameter(GenericEnvironment *env,
402402
return param;
403403
}
404404
} else if (isLargeLoadableType(env, storageType, IGM)) {
405-
if (param.getConvention() == ParameterConvention::Direct_Guaranteed)
406-
return SILParameterInfo(storageType.getASTType(),
407-
ParameterConvention::Indirect_In_Guaranteed,
408-
param.getDifferentiability());
409-
else
405+
if (param.getConvention() == ParameterConvention::Direct_Owned) {
410406
return SILParameterInfo(storageType.getASTType(),
411407
ParameterConvention::Indirect_In,
412408
param.getDifferentiability());
409+
}
410+
assert(param.getConvention() == ParameterConvention::Direct_Guaranteed
411+
|| param.getConvention() == ParameterConvention::Direct_Unowned);
412+
return SILParameterInfo(storageType.getASTType(),
413+
ParameterConvention::Indirect_In_Guaranteed,
414+
param.getDifferentiability());
413415
} else {
414416
auto newType = getNewSILType(env, storageType, IGM);
415417
return SILParameterInfo(newType.getASTType(),

test/AutoDiff/IRGen/loadable_by_address.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ func large2large(_ foo: Large) -> Large {
3939

4040
// `large2large` old verification error:
4141
// SIL verification failed: JVP type does not match expected JVP type
42-
// $@callee_guaranteed (@in Large) -> (Large, @owned @callee_guaranteed (Large.TangentVector) -> Large.TangentVector)
43-
// $@callee_guaranteed (@in Large) -> (@out Large, @owned @callee_guaranteed (@in Large.TangentVector) -> @out Large.TangentVector)
42+
// $@callee_guaranteed (@in_guaranteed Large) -> (Large, @owned @callee_guaranteed (Large.TangentVector) -> Large.TangentVector)
43+
// $@callee_guaranteed (@in_guaranteed Large) -> (@out Large, @owned @callee_guaranteed (@in_guaranteed Large.TangentVector) -> @out Large.TangentVector)
4444

4545
@_silgen_name("large2small")
4646
@differentiable(reverse)
@@ -50,26 +50,26 @@ func large2small(_ foo: Large) -> Float {
5050

5151
// `large2small` old verification error:
5252
// SIL verification failed: JVP type does not match expected JVP type
53-
// $@callee_guaranteed (@in Large) -> (Float, @owned @callee_guaranteed (Large.TangentVector) -> Float)
54-
// $@callee_guaranteed (@in Large) -> (Float, @owned @callee_guaranteed (@in Large.TangentVector) -> Float)
53+
// $@callee_guaranteed (@in_guaranteed Large) -> (Float, @owned @callee_guaranteed (Large.TangentVector) -> Float)
54+
// $@callee_guaranteed (@in_guaranteed Large) -> (Float, @owned @callee_guaranteed (@in_guaranteed Large.TangentVector) -> Float)
5555

5656
// CHECK-SIL: sil {{.*}}@large2large : $@convention(thin) (Large) -> Large {
57-
// CHECK-LBA-SIL: sil {{.*}}@large2large : $@convention(thin) (@in Large) -> @out Large {
57+
// CHECK-LBA-SIL: sil {{.*}}@large2large : $@convention(thin) (@in_guaranteed Large) -> @out Large {
5858

5959
// CHECK-SIL-LABEL: sil {{.*}}@large2small : $@convention(thin) (Large) -> Float {
60-
// CHECK-LBA-SIL: sil {{.*}}@large2small : $@convention(thin) (@in Large) -> Float {
60+
// CHECK-LBA-SIL: sil {{.*}}@large2small : $@convention(thin) (@in_guaranteed Large) -> Float {
6161

6262
// CHECK-SIL: sil {{.*}}@large2largeTJfSpSr : $@convention(thin) (Large) -> (Large, @owned @callee_guaranteed (Large.TangentVector) -> Large.TangentVector) {
63-
// CHECK-LBA-SIL: sil {{.*}}@large2largeTJfSpSr : $@convention(thin) (@in Large) -> (Large, @owned @callee_guaranteed (Large.TangentVector) -> Large.TangentVector) {
63+
// CHECK-LBA-SIL: sil {{.*}}@large2largeTJfSpSr : $@convention(thin) (@in_guaranteed Large) -> (Large, @owned @callee_guaranteed (Large.TangentVector) -> Large.TangentVector) {
6464

6565
// CHECK-SIL: sil {{.*}}@large2largeTJrSpSr : $@convention(thin) (Large) -> (Large, @owned @callee_guaranteed (Large.TangentVector) -> Large.TangentVector) {
66-
// CHECK-LBA-SIL: sil {{.*}}@large2largeTJrSpSr : $@convention(thin) (@in Large) -> (Large, @owned @callee_guaranteed (Large.TangentVector) -> Large.TangentVector) {
66+
// CHECK-LBA-SIL: sil {{.*}}@large2largeTJrSpSr : $@convention(thin) (@in_guaranteed Large) -> (Large, @owned @callee_guaranteed (Large.TangentVector) -> Large.TangentVector) {
6767

6868
// CHECK-SIL: sil {{.*}}@large2smallTJfSpSr : $@convention(thin) (Large) -> (Float, @owned @callee_guaranteed (Large.TangentVector) -> Float) {
69-
// CHECK-LBA-SIL: sil {{.*}}@large2smallTJfSpSr : $@convention(thin) (@in Large) -> (Float, @owned @callee_guaranteed (Large.TangentVector) -> Float) {
69+
// CHECK-LBA-SIL: sil {{.*}}@large2smallTJfSpSr : $@convention(thin) (@in_guaranteed Large) -> (Float, @owned @callee_guaranteed (Large.TangentVector) -> Float) {
7070

7171
// CHECK-SIL: sil {{.*}}@large2smallTJrSpSr : $@convention(thin) (Large) -> (Float, @owned @callee_guaranteed (Float) -> Large.TangentVector) {
72-
// CHECK-LBA-SIL: sil {{.*}}@large2smallTJrSpSr : $@convention(thin) (@in Large) -> (Float, @owned @callee_guaranteed (Float) -> Large.TangentVector) {
72+
// CHECK-LBA-SIL: sil {{.*}}@large2smallTJrSpSr : $@convention(thin) (@in_guaranteed Large) -> (Float, @owned @callee_guaranteed (Float) -> Large.TangentVector) {
7373

7474
LBATests.test("Correctness") {
7575
let one = Large.TangentVector(a: 1, b: 1, c: 1, d: 1)

test/AutoDiff/IRGen/loadable_by_address_cross_module.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// RUN: %target-swift-frontend -c -Xllvm -sil-print-after=loadable-address %S/Inputs/loadable_by_address_cross_module.swift 2>&1 | %FileCheck %s -check-prefix=CHECK-MODULE-POST-LBA
88

99
// CHECK-MODULE-PRE-LBA: sil {{.*}}LBAModifiedFunction{{.*}} $@convention(method) <T> (Float, LargeLoadableType<T>) -> Float
10-
// CHECK-MODULE-POST-LBA: sil {{.*}}LBAModifiedFunction{{.*}} $@convention(method) <T> (Float, @in LargeLoadableType<T>) -> Float
10+
// CHECK-MODULE-POST-LBA: sil {{.*}}LBAModifiedFunction{{.*}} $@convention(method) <T> (Float, @in_guaranteed LargeLoadableType<T>) -> Float
1111

1212
// Compile the module.
1313

@@ -24,8 +24,8 @@
2424
// CHECK-CLIENT-PRE-LBA: differentiability_witness_function [jvp] [reverse] [parameters 0 1] [results 0] <T> @${{.*}}LBAModifiedFunction{{.*}} : $@convention(method) <τ_0_0> (Float, LargeLoadableType<τ_0_0>) -> Float
2525
// CHECK-CLIENT-PRE-LBA: differentiability_witness_function [vjp] [reverse] [parameters 0 1] [results 0] <T> @${{.*}}LBAModifiedFunction{{.*}} : $@convention(method) <τ_0_0> (Float, LargeLoadableType<τ_0_0>) -> Float
2626

27-
// CHECK-CLIENT-POST-LBA: differentiability_witness_function [jvp] [reverse] [parameters 0 1] [results 0] <T> @$s8external17LargeLoadableTypeV0A19LBAModifiedFunctionyS2fF : $@convention(method) <τ_0_0> (Float, @in LargeLoadableType<τ_0_0>) -> Float as $@convention(method) <τ_0_0> (Float, @in LargeLoadableType<τ_0_0>) -> (Float, @owned @callee_guaranteed @substituted <τ_0_0> (Float, τ_0_0) -> Float for <LargeLoadableType<τ_0_0>>)
28-
// CHECK-CLIENT-POST-LBA: differentiability_witness_function [vjp] [reverse] [parameters 0 1] [results 0] <T> @$s8external17LargeLoadableTypeV0A19LBAModifiedFunctionyS2fF : $@convention(method) <τ_0_0> (Float, @in LargeLoadableType<τ_0_0>) -> Float as $@convention(method) <τ_0_0> (Float, @in LargeLoadableType<τ_0_0>) -> (Float, @owned @callee_guaranteed @substituted <τ_0_0> (Float) -> (Float, τ_0_0) for <LargeLoadableType<τ_0_0>>)
27+
// CHECK-CLIENT-POST-LBA: differentiability_witness_function [jvp] [reverse] [parameters 0 1] [results 0] <T> @$s8external17LargeLoadableTypeV0A19LBAModifiedFunctionyS2fF : $@convention(method) <τ_0_0> (Float, @in_guaranteed LargeLoadableType<τ_0_0>) -> Float as $@convention(method) <τ_0_0> (Float, @in_guaranteed LargeLoadableType<τ_0_0>) -> (Float, @owned @callee_guaranteed @substituted <τ_0_0> (Float, τ_0_0) -> Float for <LargeLoadableType<τ_0_0>>)
28+
// CHECK-CLIENT-POST-LBA: differentiability_witness_function [vjp] [reverse] [parameters 0 1] [results 0] <T> @$s8external17LargeLoadableTypeV0A19LBAModifiedFunctionyS2fF : $@convention(method) <τ_0_0> (Float, @in_guaranteed LargeLoadableType<τ_0_0>) -> Float as $@convention(method) <τ_0_0> (Float, @in_guaranteed LargeLoadableType<τ_0_0>) -> (Float, @owned @callee_guaranteed @substituted <τ_0_0> (Float) -> (Float, τ_0_0) for <LargeLoadableType<τ_0_0>>)
2929

3030
// Finally, execute the test.
3131

test/IRGen/big_types.sil

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public struct ContainsClosure {
2626
sil @make_big_struct : $@convention(thin) () -> BigStruct
2727
sil @use_big_struct : $@convention(thin) (BigStruct) -> ()
2828

29+
sil @takeClosure : $@convention(thin) (@guaranteed @noescape @callee_guaranteed () -> ()) -> ()
30+
2931
// CHECK-LABEL: sil_global @globalWithClosureInStruct : $ContainsClosure = {
3032
// CHECK: %0 = function_ref @make_big_struct : $@convention(thin) () -> @out BigStruct
3133
// CHECK-NEXT: %1 = thin_to_thick_function %0 : $@convention(thin) () -> @out BigStruct to $@callee_guaranteed () -> @out BigStruct
@@ -37,7 +39,7 @@ sil_global @globalWithClosureInStruct : $ContainsClosure = {
3739
%initval = struct $ContainsClosure (%1 : $@callee_guaranteed () -> BigStruct)
3840
}
3941

40-
// CHECK-LABEL: sil @test_yield_big : $@yield_once @convention(thin) () -> @yields @in BigStruct {
42+
// CHECK-LABEL: sil @test_yield_big : $@yield_once @convention(thin) () -> @yields @in_guaranteed BigStruct {
4143
// CHECK: bb0:
4244
// CHECK-NEXT: [[TEMP:%.*]] = alloc_stack $BigStruct
4345
// CHECK-NEXT: // function_ref
@@ -69,13 +71,13 @@ unwind:
6971
// CHECK: bb0:
7072
// CHECK-NEXT: [[TEMP:%.*]] = alloc_stack $BigStruct
7173
// CHECK-NEXT: // function_ref
72-
// CHECK-NEXT: [[CORO:%.*]] = function_ref @test_yield_big : $@yield_once @convention(thin) () -> @yields @in BigStruct
74+
// CHECK-NEXT: [[CORO:%.*]] = function_ref @test_yield_big : $@yield_once @convention(thin) () -> @yields @in_guaranteed BigStruct
7375
// CHECK-NEXT: ([[ADDR:%.*]], [[TOKEN:%.*]]) = begin_apply [[CORO]]()
7476
// TODO: this isn't very efficient
7577
// CHECK-NEXT: [[T0:%.*]] = load [[ADDR]] : $*BigStruct
7678
// CHECK-NEXT: store [[T0]] to [[TEMP]] : $*BigStruct
7779
// CHECK-NEXT: // function_ref
78-
// CHECK-NEXT: [[USE:%.*]] = function_ref @use_big_struct : $@convention(thin) (@in BigStruct) -> ()
80+
// CHECK-NEXT: [[USE:%.*]] = function_ref @use_big_struct : $@convention(thin) (@in_guaranteed BigStruct) -> ()
7981
// CHECK-NEXT: apply [[USE]]([[TEMP]])
8082
// CHECK-NEXT: end_apply [[TOKEN]]
8183
// CHECK-NEXT: [[RET:%.*]] = tuple ()
@@ -133,3 +135,26 @@ unwind:
133135
unwind
134136
}
135137

138+
// Test that partial apply captured arguments are converted to
139+
// @in_guaranteed, unless they are actually owned, which is not
140+
// allowed for on-stack closures.
141+
//
142+
// CHECK-LABEL: sil hidden @testLoadableCapture : $@convention(thin) (@in_guaranteed BigStruct) -> () {
143+
// CHECK: partial_apply [callee_guaranteed] [on_stack] %{{.*}}(%0) : $@convention(thin) (@in_guaranteed BigStruct) -> ()
144+
// CHECK-LABEL: // end sil function 'testLoadableCapture'
145+
sil hidden @testLoadableCapture : $@convention(thin) (BigStruct) -> () {
146+
bb0(%0 : $BigStruct):
147+
%2 = function_ref @testLoadableCaptureClosure : $@convention(thin) (BigStruct) -> () // user: %3
148+
%3 = partial_apply [callee_guaranteed] [on_stack] %2(%0) : $@convention(thin) (BigStruct) -> () // users: %6, %5
149+
%4 = function_ref @takeClosure : $@convention(thin) (@guaranteed @noescape @callee_guaranteed () -> ()) -> () // user: %5
150+
%5 = apply %4(%3) : $@convention(thin) (@guaranteed @noescape @callee_guaranteed () -> ()) -> ()
151+
dealloc_stack %3 : $@noescape @callee_guaranteed () -> () // id: %6
152+
%7 = tuple () // user: %8
153+
return %7 : $() // id: %8
154+
}
155+
156+
sil private @testLoadableCaptureClosure : $@convention(thin) (BigStruct) -> () {
157+
bb0(%0 : @closureCapture $BigStruct):
158+
%2 = tuple ()
159+
return %2 : $()
160+
}

test/IRGen/big_types_corner_cases.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ let bigStructGlobalArray : [BigStruct] = [
4747
]
4848

4949
// CHECK-LABEL: define{{( dllexport)?}}{{( protected)?}} internal swiftcc void @"$s22big_types_corner_cases21OptionalInoutFuncTypeC7executeyys5Error_pSgFyyXEfU_"(ptr nocapture dereferenceable({{.*}}) %0, ptr %1, ptr nocapture dereferenceable({{.*}})
50-
// CHECK: call void @"$s22big_types_corner_cases9BigStructVSgs5Error_pSgIegig_SgWOe
51-
// CHECK: call void @"$s22big_types_corner_cases9BigStructVSgs5Error_pSgIegig_SgWOy
50+
// CHECK: call void @"$s22big_types_corner_cases9BigStructVSgs5Error_pSgIegng_SgWOe
51+
// CHECK: call void @"$s22big_types_corner_cases9BigStructVSgs5Error_pSgIegng_SgWOy
5252
// CHECK: ret void
5353

5454
public func f1_returns_BigType(_ x: BigStruct) -> BigStruct {

test/IRGen/distributed_func_indirect_in_parameter.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public struct LargeValue : Codable {
2121
distributed actor D {
2222
typealias ActorSystem = LocalTestingDistributedActorSystem
2323

24-
// CHECK: sil hidden [distributed] @takeLarge : $@convention(method) (@in LargeValue, @guaranteed D) -> () {
24+
// CHECK: sil hidden [distributed] @takeLarge : $@convention(method) (@in_guaranteed LargeValue, @guaranteed D) -> () {
2525
@_silgen_name("takeLarge")
2626
distributed func takeLarge(_ l: LargeValue) {}
27-
}
27+
}

test/IRGen/indirect_argument.sil

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,12 @@ entry(%o : $*Huge, %x : $Huge):
7070
// CHECK: [[CLOSURE:%.*]] = call noalias ptr @swift_allocObject
7171
// CHECK: call swiftcc {{.*}} @"$s24huge_partial_applicationTA{{(\.ptrauth)?}}"{{.*}}(ptr noalias nocapture dereferenceable({{.*}}) %0, ptr swiftself [[CLOSURE]])
7272
// CHECK: define internal swiftcc void @"$s24huge_partial_applicationTA"(ptr noalias nocapture dereferenceable({{.*}}) %0, ptr swiftself %1)
73-
// CHECK: [[TMP_ARG:%.*]] = alloca
73+
// CHECK-NOT: alloca
74+
// CHECK: [[GEP:%.*]] = getelementptr inbounds <{ %swift.refcounted, %T17indirect_argument4HugeV }>, ptr %1, i32 0, i32 1
75+
// CHECK-NOT: alloca
7476
// CHECK-NOT: tail
75-
// CHECK: call swiftcc void @huge_partial_application(ptr noalias nocapture dereferenceable({{.*}}) %0, ptr noalias nocapture dereferenceable({{.*}}) [[TMP_ARG]])
77+
// CHECK: call swiftcc void @huge_partial_application(ptr noalias nocapture dereferenceable({{.*}}) %0, ptr noalias nocapture dereferenceable({{.*}}) [[GEP]]
78+
// CHECK: call void @swift_release(ptr %1)
7679
sil @huge_partial_application : $@convention(thin) (Huge, Huge) -> () {
7780
entry(%x : $Huge, %y : $Huge):
7881
%f = function_ref @huge_partial_application : $@convention(thin) (Huge, Huge) -> ()
@@ -86,9 +89,12 @@ entry(%x : $Huge, %y : $Huge):
8689
// CHECK: [[CLOSURE:%.*]] = call noalias ptr @swift_allocObject
8790
// CHECK: call swiftcc {{.*}} @"$s30huge_partial_application_stretTA{{(\.ptrauth)?}}"{{.*}}(ptr noalias nocapture sret({{.*}}) [[TMP_RET]], ptr noalias nocapture dereferenceable({{.*}}) %1, ptr swiftself [[CLOSURE]])
8891
// CHECK: define internal swiftcc void @"$s30huge_partial_application_stretTA"(ptr noalias nocapture sret({{.*}}) %0, ptr noalias nocapture dereferenceable({{.*}}) %1, ptr swiftself %2)
89-
// CHECK: [[TMP_ARG:%.*]] = alloca
92+
// CHECK-NOT: alloca
93+
// CHECK: [[GEP:%.*]] = getelementptr inbounds <{ %swift.refcounted, %T17indirect_argument4HugeV }>, ptr %2, i32 0, i32 1
94+
// CHECK-NOT: alloca
9095
// CHECK-NOT: tail
91-
// CHECK: call swiftcc void @huge_partial_application_stret(ptr noalias nocapture sret({{.*}}) %0, ptr noalias nocapture dereferenceable({{.*}}) %1, ptr noalias nocapture dereferenceable({{.*}}) [[TMP_ARG]])
96+
// CHECK: call swiftcc void @huge_partial_application_stret(ptr noalias nocapture sret({{.*}}) %0, ptr noalias nocapture dereferenceable({{.*}}) %1, ptr noalias nocapture dereferenceable({{.*}}) [[GEP]])
97+
// CHECK: call void @swift_release(ptr %2)
9298
sil @huge_partial_application_stret : $@convention(thin) (Huge, Huge) -> Huge {
9399
entry(%x : $Huge, %y : $Huge):
94100
%f = function_ref @huge_partial_application_stret : $@convention(thin) (Huge, Huge) -> Huge

test/SILOptimizer/closure_specialize_attrs.sil

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,35 +16,34 @@ struct Val {}
1616
// CHECK: {{bb[0-9]+}}({{%[^,]+}} : @_eagerMove @owned $C, {{%[^,]+}} :
1717
// CHECK-LABEL: } // end sil function '$s12take_closure0B04main1CCTf1nc_n'
1818

19-
sil [ossa] [noinline] @take_closure : $@convention(thin) (@owned C, @guaranteed @noescape @callee_guaranteed (@owned C, @owned C) -> ()) -> () {
20-
bb0(%c : @_eagerMove @owned $C, %0 : @guaranteed $@noescape @callee_guaranteed (@owned C, @owned C) -> ()):
19+
sil [ossa] [noinline] @take_closure : $@convention(thin) (@owned C, @guaranteed @noescape @callee_guaranteed (@guaranteed C, @guaranteed C) -> ()) -> () {
20+
bb0(%c : @_eagerMove @owned $C, %0 : @guaranteed $@noescape @callee_guaranteed (@guaranteed C, @guaranteed C) -> ()):
2121
%getC = function_ref @getC : $@convention(thin) () -> @owned C
2222
%c1 = apply %getC() : $@convention(thin) () -> @owned C
2323
%c2 = apply %getC() : $@convention(thin) () -> @owned C
24-
%3 = apply %0(%c1, %c2) : $@noescape @callee_guaranteed (@owned C, @owned C) -> ()
24+
%3 = apply %0(%c1, %c2) : $@noescape @callee_guaranteed (@guaranteed C, @guaranteed C) -> ()
25+
destroy_value %c2 : $C
26+
destroy_value %c1 : $C
2527
destroy_value %c : $C
2628
%retval = tuple()
2729
return %retval : $()
2830
}
2931

30-
sil shared [ossa] @closure : $@convention(thin) (@owned C, @owned C, @owned C) -> () {
31-
bb0(%0 : @owned $C, %1 : @owned $C, %2 : @owned $C):
32-
destroy_value %0 : $C
33-
destroy_value %1 : $C
34-
destroy_value %2 : $C
32+
sil shared [ossa] @closure : $@convention(thin) (@guaranteed C, @guaranteed C, @guaranteed C) -> () {
33+
bb0(%0 : @guaranteed $C, %1 : @guaranteed $C, %2 : @guaranteed $C):
3534
%15 = tuple ()
3635
return %15 : $()
3736
}
3837

3938
sil @caller : $@convention(thin) (@owned C) -> () {
4039
bb0(%0 : $C):
41-
%3 = function_ref @closure : $@convention(thin) (@owned C, @owned C, @owned C) -> ()
42-
%4 = partial_apply [callee_guaranteed] [on_stack] %3(%0) : $@convention(thin) (@owned C, @owned C, @owned C) -> ()
43-
%take_closure = function_ref @take_closure : $@convention(thin) (@owned C, @guaranteed @noescape @callee_guaranteed (@owned C, @owned C) -> ()) -> ()
40+
%3 = function_ref @closure : $@convention(thin) (@guaranteed C, @guaranteed C, @guaranteed C) -> ()
41+
%4 = partial_apply [callee_guaranteed] [on_stack] %3(%0) : $@convention(thin) (@guaranteed C, @guaranteed C, @guaranteed C) -> ()
42+
%take_closure = function_ref @take_closure : $@convention(thin) (@owned C, @guaranteed @noescape @callee_guaranteed (@guaranteed C, @guaranteed C) -> ()) -> ()
4443
strong_retain %0 : $C
45-
%5 = apply %take_closure(%0, %4) : $@convention(thin) (@owned C, @guaranteed @noescape @callee_guaranteed (@owned C, @owned C) -> ()) -> ()
44+
%5 = apply %take_closure(%0, %4) : $@convention(thin) (@owned C, @guaranteed @noescape @callee_guaranteed (@guaranteed C, @guaranteed C) -> ()) -> ()
4645
strong_release %0 : $C
47-
dealloc_stack %4 : $@noescape @callee_guaranteed (@owned C, @owned C) -> ()
46+
dealloc_stack %4 : $@noescape @callee_guaranteed (@guaranteed C, @guaranteed C) -> ()
4847
%retval = tuple()
4948
return %retval : $()
5049
}

0 commit comments

Comments
 (0)