@@ -26,6 +26,10 @@ struct GV<each T> {
26
26
var tu: (repeat each T)
27
27
}
28
28
29
+ struct G<T> {
30
+ var t: T
31
+ }
32
+
29
33
sil @takeTypePack : $<each T>() -> ()
30
34
sil @take : $<T>(@in T) -> ()
31
35
@@ -56,6 +60,16 @@ entry:
56
60
// BEGIN: Instructions: Apply {{
57
61
// =============================================================================
58
62
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
+
59
73
// A pack directly in the signature results in markers.
60
74
// CHECK-SIL-LABEL: sil @forward_type_pack {{.*}} {
61
75
// CHECK-SIL: [[TAKE:%[^,]+]] = function_ref @takeTypePack
@@ -106,6 +120,33 @@ entry(%gv : $*GV<T, S2, S3>):
106
120
%retval = tuple ()
107
121
return %retval : $()
108
122
}
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
+
109
150
// =============================================================================
110
151
// FINISH: Instructions: Apply }}
111
152
// =============================================================================
0 commit comments