1
1
// RUN: %empty-directory(%t)
2
- // RUN: %target-build-swift-dylib(%t/%target-library-name(PrintShims)) %S/../Inputs/print-shims.swift -module-name PrintShims -emit-module -emit-module-path %t/PrintShims.swiftmodule
2
+ // RUN: %target-build-swift-dylib(%t/%target-library-name(PrintShims)) -parse-stdlib %S/../Inputs/print-shims-stdlib .swift -module-name PrintShims -emit-module -emit-module-path %t/PrintShims.swiftmodule
3
3
// RUN: %target-codesign %t/%target-library-name(PrintShims)
4
4
// RUN: %target-build-swift -enable-experimental-feature VariadicGenerics -g -parse-sil %s -emit-ir -I %t -L %t -lPrintShim | %FileCheck %s --check-prefix=CHECK-LL
5
5
// RUN: %target-build-swift -enable-experimental-feature VariadicGenerics -g -parse-sil %s -module-name main -o %t/main -I %t -L %t -lPrintShims %target-rpath(%t)
@@ -18,6 +18,7 @@ import Swift
18
18
import PrintShims
19
19
20
20
sil public_external @printGenericType : $@convention(thin) <T> (@thick T.Type) -> ()
21
+ sil public_external @printGenericTypeAndWord : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
21
22
22
23
protocol P {
23
24
static func static_member_fn()
@@ -47,8 +48,9 @@ struct G : P {
47
48
48
49
sil private @A_static_member_fn : $@convention(witness_method: P) (@thick A.Type) -> () {
49
50
bb0(%0 : $@thick A.Type):
50
- %printGenericType = function_ref @printGenericType : $@convention(thin) <T> (@thick T.Type) -> ()
51
- apply %printGenericType<A>(%0) : $@convention(thin) <T> (@thick T.Type) -> ()
51
+ %printGenericTypeAndWord = function_ref @printGenericTypeAndWord : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
52
+ %id = integer_literal $Builtin.Word, 0
53
+ apply %printGenericTypeAndWord<A>(%0, %id) : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
52
54
%4 = tuple ()
53
55
return %4 : $()
54
56
}
@@ -57,8 +59,9 @@ sil_witness_table A : P module main {
57
59
}
58
60
sil private @B_static_member_fn : $@convention(witness_method: P) (@thick B.Type) -> () {
59
61
bb0(%0 : $@thick B.Type):
60
- %printGenericType = function_ref @printGenericType : $@convention(thin) <T> (@thick T.Type) -> ()
61
- apply %printGenericType<B>(%0) : $@convention(thin) <T> (@thick T.Type) -> ()
62
+ %printGenericTypeAndWord = function_ref @printGenericTypeAndWord : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
63
+ %id = integer_literal $Builtin.Word, 1
64
+ apply %printGenericTypeAndWord<B>(%0, %id) : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
62
65
%4 = tuple ()
63
66
return %4 : $()
64
67
}
@@ -67,8 +70,9 @@ sil_witness_table B : P module main {
67
70
}
68
71
sil private @C_static_member_fn : $@convention(witness_method: P) (@thick C.Type) -> () {
69
72
bb0(%0 : $@thick C.Type):
70
- %printGenericType = function_ref @printGenericType : $@convention(thin) <T> (@thick T.Type) -> ()
71
- apply %printGenericType<C>(%0) : $@convention(thin) <T> (@thick T.Type) -> ()
73
+ %printGenericTypeAndWord = function_ref @printGenericTypeAndWord : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
74
+ %id = integer_literal $Builtin.Word, 2
75
+ apply %printGenericTypeAndWord<C>(%0, %id) : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
72
76
%4 = tuple ()
73
77
return %4 : $()
74
78
}
@@ -77,8 +81,9 @@ sil_witness_table C : P module main {
77
81
}
78
82
sil private @D_static_member_fn : $@convention(witness_method: P) (@thick D.Type) -> () {
79
83
bb0(%0 : $@thick D.Type):
80
- %printGenericType = function_ref @printGenericType : $@convention(thin) <T> (@thick T.Type) -> ()
81
- apply %printGenericType<D>(%0) : $@convention(thin) <T> (@thick T.Type) -> ()
84
+ %printGenericTypeAndWord = function_ref @printGenericTypeAndWord : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
85
+ %id = integer_literal $Builtin.Word, 3
86
+ apply %printGenericTypeAndWord<D>(%0, %id) : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
82
87
%4 = tuple ()
83
88
return %4 : $()
84
89
}
@@ -87,8 +92,9 @@ sil_witness_table D : P module main {
87
92
}
88
93
sil private @E_static_member_fn : $@convention(witness_method: P) (@thick E.Type) -> () {
89
94
bb0(%0 : $@thick E.Type):
90
- %printGenericType = function_ref @printGenericType : $@convention(thin) <T> (@thick T.Type) -> ()
91
- apply %printGenericType<E>(%0) : $@convention(thin) <T> (@thick T.Type) -> ()
95
+ %printGenericTypeAndWord = function_ref @printGenericTypeAndWord : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
96
+ %id = integer_literal $Builtin.Word, 4
97
+ apply %printGenericTypeAndWord<E>(%0, %id) : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
92
98
%4 = tuple ()
93
99
return %4 : $()
94
100
}
@@ -97,8 +103,9 @@ sil_witness_table E : P module main {
97
103
}
98
104
sil private @F_static_member_fn : $@convention(witness_method: P) (@thick F.Type) -> () {
99
105
bb0(%0 : $@thick F.Type):
100
- %printGenericType = function_ref @printGenericType : $@convention(thin) <T> (@thick T.Type) -> ()
101
- apply %printGenericType<F>(%0) : $@convention(thin) <T> (@thick T.Type) -> ()
106
+ %printGenericTypeAndWord = function_ref @printGenericTypeAndWord : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
107
+ %id = integer_literal $Builtin.Word, 5
108
+ apply %printGenericTypeAndWord<F>(%0, %id) : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
102
109
%4 = tuple ()
103
110
return %4 : $()
104
111
}
@@ -107,8 +114,9 @@ sil_witness_table F : P module main {
107
114
}
108
115
sil private @G_static_member_fn : $@convention(witness_method: P) (@thick G.Type) -> () {
109
116
bb0(%0 : $@thick G.Type):
110
- %printGenericType = function_ref @printGenericType : $@convention(thin) <T> (@thick T.Type) -> ()
111
- apply %printGenericType<G>(%0) : $@convention(thin) <T> (@thick T.Type) -> ()
117
+ %printGenericTypeAndWord = function_ref @printGenericTypeAndWord : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
118
+ %id = integer_literal $Builtin.Word, 6
119
+ apply %printGenericTypeAndWord<G>(%0, %id) : $@convention(thin) <T> (@thick T.Type, Builtin.Word) -> ()
112
120
%4 = tuple ()
113
121
return %4 : $()
114
122
}
@@ -205,55 +213,67 @@ bb0(%argc : $Int32, %argv : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<
205
213
// ---0--> ^
206
214
// CHECK: A
207
215
// CHECK: A
216
+ // CHECK: 0
208
217
// U_2 -> {D, E, F, A, B, C}
209
218
// ---0--> ^
210
219
// CHECK: D
211
220
// CHECK: D
221
+ // CHECK: 3
212
222
apply %two_archetypes_from_two_params_no_singles_with_conformance<Pack{A, B, C}, Pack{D, E, F}>(%0) : $@convention(thin) <T_1... : P, T_2... : P where (repeat (each T_1, each T_2)): Any> (Builtin.Word) -> ()
213
223
// U_1 -> {A, B, C, D, E, F}
214
224
// ----1----> ^
215
225
// CHECK: B
216
226
// CHECK: B
227
+ // CHECK: 1
217
228
// U_2 -> {D, E, F, A, B, C}
218
229
// ----1----> ^
219
230
// CHECK: E
220
231
// CHECK: E
232
+ // CHECK: 4
221
233
apply %two_archetypes_from_two_params_no_singles_with_conformance<Pack{A, B, C}, Pack{D, E, F}>(%1) : $@convention(thin) <T_1... : P, T_2... : P where (repeat (each T_1, each T_2)): Any> (Builtin.Word) -> ()
222
234
// U_1 -> {A, B, C, D, E, F}
223
235
// ------2-----> ^
224
236
// CHECK: C
225
237
// CHECK: C
238
+ // CHECK: 2
226
239
// U_2 -> {D, E, F, A, B, C}
227
240
// ------2-----> ^
228
241
// CHECK: F
229
242
// CHECK: F
243
+ // CHECK: 5
230
244
apply %two_archetypes_from_two_params_no_singles_with_conformance<Pack{A, B, C}, Pack{D, E, F}>(%2) : $@convention(thin) <T_1... : P, T_2... : P where (repeat (each T_1, each T_2)): Any> (Builtin.Word) -> ()
231
245
// U_1 -> {A, B, C, D, E, F}
232
246
// -------3-------> ^
233
247
// CHECK: D
234
248
// CHECK: D
249
+ // CHECK: 3
235
250
// U_2 -> {D, E, F, A, B, C}
236
251
// -------3-------> ^
237
252
// CHECK: A
238
253
// CHECK: A
254
+ // CHECK: 0
239
255
apply %two_archetypes_from_two_params_no_singles_with_conformance<Pack{A, B, C}, Pack{D, E, F}>(%3) : $@convention(thin) <T_1... : P, T_2... : P where (repeat (each T_1, each T_2)): Any> (Builtin.Word) -> ()
240
256
// U_1 -> {A, B, C, D, E, F}
241
257
// ---------4--------> ^
242
258
// CHECK: E
243
259
// CHECK: E
260
+ // CHECK: 4
244
261
// U_2 -> {D, E, F, A, B, C}
245
262
// ---------4--------> ^
246
263
// CHECK: B
247
264
// CHECK: B
265
+ // CHECK: 1
248
266
apply %two_archetypes_from_two_params_no_singles_with_conformance<Pack{A, B, C}, Pack{D, E, F}>(%4) : $@convention(thin) <T_1... : P, T_2... : P where (repeat (each T_1, each T_2)): Any> (Builtin.Word) -> ()
249
267
// U_1 -> {A, B, C, D, E, F}
250
268
// -----------5---------> ^
251
269
// CHECK: F
252
270
// CHECK: F
271
+ // CHECK: 5
253
272
// U_2 -> {D, E, F, A, B, C}
254
273
// -----------5---------> ^
255
274
// CHECK: C
256
275
// CHECK: C
276
+ // CHECK: 2
257
277
apply %two_archetypes_from_two_params_no_singles_with_conformance<Pack{A, B, C}, Pack{D, E, F}>(%5) : $@convention(thin) <T_1... : P, T_2... : P where (repeat (each T_1, each T_2)): Any> (Builtin.Word) -> ()
258
278
259
279
@@ -262,31 +282,37 @@ bb0(%argc : $Int32, %argv : $UnsafeMutablePointer<Optional<UnsafeMutablePointer<
262
282
// --0---> ^
263
283
// CHECK: A
264
284
// CHECK: A
285
+ // CHECK: 0
265
286
apply %direct_access_from_parameter_with_conformance<Pack{A, B, C, D, E, F}>(%0) : $@convention(thin) <T_1... : P> (Builtin.Word) -> ()
266
287
// U_1 -> {A, B, C, D, E, F}
267
288
// ----1----> ^
268
289
// CHECK: B
269
290
// CHECK: B
291
+ // CHECK: 1
270
292
apply %direct_access_from_parameter_with_conformance<Pack{A, B, C, D, E, F}>(%1) : $@convention(thin) <T_1... : P> (Builtin.Word) -> ()
271
293
// U_1 -> {A, B, C, D, E, F}
272
294
// -----2------> ^
273
295
// CHECK: C
274
296
// CHECK: C
297
+ // CHECK: 2
275
298
apply %direct_access_from_parameter_with_conformance<Pack{A, B, C, D, E, F}>(%2) : $@convention(thin) <T_1... : P> (Builtin.Word) -> ()
276
299
// U_1 -> {A, B, C, D, E, F}
277
300
// -------3-------> ^
278
301
// CHECK: D
279
302
// CHECK: D
303
+ // CHECK: 3
280
304
apply %direct_access_from_parameter_with_conformance<Pack{A, B, C, D, E, F}>(%3) : $@convention(thin) <T_1... : P> (Builtin.Word) -> ()
281
305
// U_1 -> {A, B, C, D, E, F}
282
306
// --------4---------> ^
283
307
// CHECK: E
284
308
// CHECK: E
309
+ // CHECK: 4
285
310
apply %direct_access_from_parameter_with_conformance<Pack{A, B, C, D, E, F}>(%4) : $@convention(thin) <T_1... : P> (Builtin.Word) -> ()
286
311
// U_1 -> {A, B, C, D, E, F}
287
312
// ----------5----------> ^
288
313
// CHECK: F
289
314
// CHECK: F
315
+ // CHECK: 5
290
316
apply %direct_access_from_parameter_with_conformance<Pack{A, B, C, D, E, F}>(%5) : $@convention(thin) <T_1... : P> (Builtin.Word) -> ()
291
317
292
318
%outb = integer_literal $Builtin.Int32, 0
0 commit comments