@@ -803,7 +803,7 @@ struct S {
803803}
804804
805805// CHECK-LABEL: sil [ossa] @testStruct :
806- // CHECK: [[C]] = function_ref @$s17closureWithStruct4main1SVs5Int32VSbTf3npSSi3Si0_n : $@convention(thin) (Str) -> Builtin.Int32
806+ // CHECK: [[C:%.* ]] = function_ref @$s17closureWithStruct4main1SVs5Int32VSbTf3npSSi3Si0_n : $@convention(thin) (Str) -> Builtin.Int32
807807// CHECK: thin_to_thick_function [[C]] : $@convention(thin) (Str) -> Builtin.Int32 to $@callee_guaranteed (Str) -> Builtin.Int32
808808// CHECK: } // end sil function 'testStruct'
809809sil [ossa] @testStruct : $@convention(thin) () -> () {
@@ -843,3 +843,35 @@ bb0(%0 : $Str, %1 : $S):
843843}
844844
845845sil @swift_getAtKeyPath : $@convention(thin) <τ_0_0, τ_0_1> (@in_guaranteed τ_0_0, @guaranteed KeyPath<τ_0_0, τ_0_1>) -> @out τ_0_1
846+
847+ struct NonTrivialStruct {
848+ var x: AnyObject
849+ }
850+
851+ sil_global [serialized] @gNonTrivialStruct : $NonTrivialStruct
852+
853+ // CHECK-LABEL: sil [ossa] @test_global_addr :
854+ // CHECK: [[C:%.*]] = function_ref @$s19global_addr_closure17gNonTrivialStructTf3pg_n : $@convention(thin) () -> ()
855+ // CHECK: thin_to_thick_function %2 : $@convention(thin) () -> () to $@callee_owned () -> ()
856+ // CHECK: } // end sil function 'test_global_addr'
857+ sil [ossa] @test_global_addr : $@convention(thin) () -> () {
858+ %3 = global_addr @gNonTrivialStruct : $*NonTrivialStruct
859+ %7 = function_ref @global_addr_closure : $@convention(thin) <T> (@in_guaranteed T) -> ()
860+ %8 = partial_apply %7<NonTrivialStruct>(%3) : $@convention(thin) <T> (@in_guaranteed T) -> ()
861+ destroy_value %8
862+ %r = tuple()
863+ return %r
864+ }
865+
866+ // CHECK-LABEL: sil shared [ossa] @$s19global_addr_closure17gNonTrivialStructTf3pg_n :
867+ // CHECK: bb0:
868+ // CHECK-NEXT: %0 = global_addr @gNonTrivialStruct : $*NonTrivialStruct
869+ // CHECK-NEXT: %1 = tuple ()
870+ // CHECK-NEXT: return %1
871+ // CHECK: } // end sil function '$s19global_addr_closure17gNonTrivialStructTf3pg_n'
872+ sil [ossa] @global_addr_closure : $@convention(thin) <T> (@in_guaranteed T) -> () {
873+ bb0(%0 : $*T):
874+ %r = tuple()
875+ return %r : $()
876+ }
877+
0 commit comments