1
- // RUN: %swift -target %module-target-future -emit-ir -prespecialize-generic-metadata %s | %FileCheck %s
1
+ // RUN: %swift -target %module-target-future -emit-ir -prespecialize-generic-metadata %s | %FileCheck %s -DINT=i%target-ptrsize -DALIGNMENT=%target-alignment
2
+
3
+ // UNSUPPORTED: CPU=i386 && OS=ios
4
+ // UNSUPPORTED: CPU=armv7 && OS=ios
5
+ // UNSUPPORTED: CPU=armv7s && OS=ios
2
6
3
7
// CHECK: @"$sytN" = external global %swift.full_type
4
- // CHECK: @"$s4main5ValueVySiGMf" = internal constant <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i32, [4 x i8], i64 }> <{ i8** getelementptr inbounds (%swift.vwtable, %swift.vwtable* @"$s4main5ValueVWV", i32 0, i32 0), i64 512, %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8, i32, i32, i32 }>* @"$s4main5ValueVMn" to %swift.type_descriptor*), %swift.type* @"$sSiN", i8** getelementptr inbounds ([1 x i8*], [1 x i8*]* @"$sSi4main1PAAWP", i32 0, i32 0), i32 0, [4 x i8] zeroinitializer, i64 3 }>, align 8
8
+ // CHECK: @"$sB[[INT]]_WV" = external global i8*, align [[ALIGNMENT]]
9
+ // CHECK: @"$s4main5ValueVySiGMf" = internal constant <{ i8**, [[INT]], %swift.type_descriptor*, %swift.type*, i8**, i32{{(, \[4 x i8\])?}}, i64 }> <{ i8** @"$sB[[INT]]_WV", [[INT]] 512, %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8, i32, i32, i32 }>* @"$s4main5ValueVMn" to %swift.type_descriptor*), %swift.type* @"$sSiN", i8** getelementptr inbounds ([1 x i8*], [1 x i8*]* @"$sSi4main1PAAWP", i32 0, i32 0), i32 0{{(, \[4 x i8\] zeroinitializer)?}}, i64 3 }>, align [[ALIGNMENT]]
5
10
protocol P { }
6
11
extension Int : P { }
7
12
struct Value < First : P > {
@@ -15,15 +20,15 @@ func consume<T>(_ t: T) {
15
20
}
16
21
17
22
// CHECK: define hidden swiftcc void @"$s4main4doityyF"() #{{[0-9]+}} {
18
- // CHECK: call swiftcc void @"$s4main7consumeyyxlF"(%swift.opaque* noalias nocapture %{{[0-9]+}}, %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, i64 , %swift.type_descriptor*, %swift.type*, i8**, i32, [4 x i8] , i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1))
23
+ // CHECK: call swiftcc void @"$s4main7consumeyyxlF"(%swift.opaque* noalias nocapture %{{[0-9]+}}, %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, [[INT]] , %swift.type_descriptor*, %swift.type*, i8**, i32{{(, \ [4 x i8\])?}} , i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1))
19
24
// CHECK: }
20
25
func doit( ) {
21
26
consume ( Value ( first: 13 ) )
22
27
}
23
28
doit ( )
24
29
25
30
// CHECK: ; Function Attrs: noinline nounwind readnone
26
- // CHECK: define hidden swiftcc %swift.metadata_response @"$s4main5ValueVMa"(i64 , %swift.type*, i8**) #{{[0-9]+}} {
31
+ // CHECK: define hidden swiftcc %swift.metadata_response @"$s4main5ValueVMa"([[INT]] , %swift.type*, i8**) #{{[0-9]+}} {
27
32
// CHECK: entry:
28
33
// CHECK: [[ERASED_TYPE:%[0-9]+]] = bitcast %swift.type* %1 to i8*
29
34
// CHECK: [[ERASED_TABLE:%[0-9]+]] = bitcast i8** %2 to i8*
33
38
// CHECK: [[EQUAL_TYPES:%[0-9]+]] = and i1 true, [[EQUAL_TYPE]]
34
39
// CHECK: br i1 [[EQUAL_TYPES]], label %[[EXIT_PRESPECIALIZED:[0-9]+]], label %[[EXIT_NORMAL:[0-9]+]]
35
40
// CHECK: [[EXIT_PRESPECIALIZED]]:
36
- // CHECK: ret %swift.metadata_response { %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, i64 , %swift.type_descriptor*, %swift.type*, i8**, i32, [4 x i8] , i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1), i64 0 }
41
+ // CHECK: ret %swift.metadata_response { %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, [[INT]] , %swift.type_descriptor*, %swift.type*, i8**, i32{{(, \ [4 x i8\])?}} , i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1), [[INT]] 0 }
37
42
// CHECK: [[EXIT_NORMAL]]:
38
- // CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateGenericMetadata(i64 %0, i8* [[ERASED_TYPE]], i8* [[ERASED_TABLE]], i8* undef, %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8, i32, i32, i32 }>* @"$s4main5ValueVMn" to %swift.type_descriptor*)) #12
43
+ // CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateGenericMetadata([[INT]] %0, i8* [[ERASED_TYPE]], i8* [[ERASED_TABLE]], i8* undef, %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8, i32, i32, i32 }>* @"$s4main5ValueVMn" to %swift.type_descriptor*)) #12
39
44
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
40
45
// CHECK: }
0 commit comments