@@ -26,6 +26,10 @@ struct GV<each T> {
2626 var tu: (repeat each T)
2727}
2828
29+ struct G<T> {
30+ var t: T
31+ }
32+
2933sil @takeTypePack : $<each T>() -> ()
3034sil @take : $<T>(@in T) -> ()
3135
@@ -56,6 +60,16 @@ entry:
5660// BEGIN: Instructions: Apply {{
5761// =============================================================================
5862
63+ // CHECK-SIL-LABEL: sil @no_markers_for_apply_without_pack : $@convention(thin) () -> () {
64+ // CHECK-SIL-NOT: alloc_pack_metadata
65+ // CHECK-SIL-LABEL: } // end sil function 'no_markers_for_apply_without_pack'
66+ sil @no_markers_for_apply_without_pack : $() -> () {
67+ entry:
68+ apply undef() : $@convention(thin) () -> ()
69+ %retval = tuple ()
70+ return %retval : $()
71+ }
72+
5973// A pack directly in the signature results in markers.
6074// CHECK-SIL-LABEL: sil @forward_type_pack {{.*}} {
6175// CHECK-SIL: [[TAKE:%[^,]+]] = function_ref @takeTypePack
@@ -106,6 +120,33 @@ entry(%gv : $*GV<T, S2, S3>):
106120 %retval = tuple ()
107121 return %retval : $()
108122}
123+
124+ // A _non_-variadic generic type within the signature doesn't entail a marker.
125+ // CHECK-SIL-LABEL: sil @apply_with_generic_instance : {{.*}} {
126+ // CHECK-SIL-NOT: alloc_pack_metadata
127+ // CHECK-SIL-LABEL: } // end sil function 'apply_with_generic_instance'
128+ sil @apply_with_generic_instance : $<T>(@in G<T>) -> () {
129+ entry(%g : $*G<T>):
130+ %take = function_ref @take : $@convention(thin) <T>(@in T) -> ()
131+ apply %take<G<T>>(%g) : $@convention(thin) <T>(@in T) -> ()
132+ %retval = tuple ()
133+ return %retval : $()
134+ }
135+
136+ // CHECK-SIL-LABEL: sil @apply_variadic_with_generic_instance : {{.*}} {
137+ // CHECK-SIL: [[TAKE:%[^,]+]] = function_ref @takeTypePack
138+ // CHECK-SIL: [[MARKER:%[^,]+]] = alloc_pack_metadata
139+ // CHECK-SIL: apply [[TAKE]]
140+ // CHECK-SIL: dealloc_pack_metadata [[MARKER]]
141+ // CHECK-SIL-LABEL: } // end sil function 'apply_variadic_with_generic_instance'
142+ sil @apply_variadic_with_generic_instance : $<T>() -> () {
143+ entry:
144+ %take = function_ref @takeTypePack : $@convention(thin) <each T>() -> ()
145+ apply %take<Pack{G<T>}>() : $@convention(thin) <each T>() -> ()
146+ %retval = tuple ()
147+ return %retval : $()
148+ }
149+
109150// =============================================================================
110151// FINISH: Instructions: Apply }}
111152// =============================================================================
0 commit comments