Skip to content

Commit 686c49a

Browse files
committed
[IRGen] Don't add prespecialized metadata to ABI.
The usages of a type that happen to be made in a module are implementation details of that module and should not be exported.
1 parent 9e2e090 commit 686c49a

19 files changed

+190
-70
lines changed

lib/IRGen/GenDecl.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3671,8 +3671,11 @@ llvm::GlobalValue *IRGenModule::defineTypeMetadata(CanType concreteType,
36713671
if (nominal)
36723672
addRuntimeResolvableType(nominal);
36733673

3674-
// Don't define the alias for foreign type metadata, since it's not ABI.
3675-
if (nominal && requiresForeignTypeMetadata(nominal))
3674+
// Don't define the alias for foreign type metadata or prespecialized generic
3675+
// metadata, since neither is ABI.
3676+
if ((nominal && requiresForeignTypeMetadata(nominal)) ||
3677+
(concreteType->getAnyGeneric() &&
3678+
concreteType->getAnyGeneric()->isGenericContext()))
36763679
return var;
36773680

36783681
// For concrete metadata, declare the alias to its address point.
@@ -3708,7 +3711,9 @@ ConstantReference IRGenModule::getAddrOfTypeMetadata(CanType concreteType,
37083711
llvm::Type *defaultVarTy;
37093712
unsigned adjustmentIndex;
37103713

3711-
bool fullMetadata = (nominal && requiresForeignTypeMetadata(nominal));
3714+
bool fullMetadata = (nominal && requiresForeignTypeMetadata(nominal)) ||
3715+
(concreteType->getAnyGeneric() &&
3716+
concreteType->getAnyGeneric()->isGenericContext());
37123717

37133718
// Foreign classes reference the full metadata with a GEP.
37143719
if (fullMetadata) {
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
// RUN: %swift -target %module-target-future -emit-ir -prespecialize-generic-metadata %s | %FileCheck %s
2+
3+
// CHECK: @"$s4main5Value[[UNIQUE_ID_1:[0-9A-Z_]+]]VySiGMf" = internal constant <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }> <{ i8** getelementptr inbounds (%swift.vwtable, %swift.vwtable* @"$s4main5Value[[UNIQUE_ID_1]]VWV", 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 }>* @"$s4main5Value[[UNIQUE_ID_1]]VMn" to %swift.type_descriptor*), %swift.type* @"$sSiN", i32 0, [4 x i8] zeroinitializer, i64 3 }>, align 8
4+
fileprivate struct Value<First> {
5+
let first: First
6+
}
7+
8+
@inline(never)
9+
func consume<T>(_ t: T) {
10+
withExtendedLifetime(t) { t in
11+
}
12+
}
13+
14+
// CHECK: define hidden swiftcc void @"$s4main4doityyF"() #{{[0-9]+}} {
15+
// 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*, i32, [4 x i8], i64 }>* @"$s4main5Value[[UNIQUE_ID_1]]VySiGMf" to %swift.full_type*), i32 0, i32 1))
16+
// CHECK: }
17+
func doit() {
18+
consume( Value(first: 13) )
19+
}
20+
doit()
21+
22+
// CHECK: ; Function Attrs: noinline nounwind readnone
23+
// CHECK: define internal swiftcc %swift.metadata_response @"$s4main5Value[[UNIQUE_ID_1]]VMa"(i64, %swift.type*) #{{[0-9]+}} {
24+
// CHECK: entry:
25+
// CHECK: [[ERASED_TYPE:%[0-9]+]] = bitcast %swift.type* %1 to i8*
26+
// CHECK: br label %[[TYPE_COMPARISON_LABEL:[0-9]+]]
27+
// CHECK: [[TYPE_COMPARISON_LABEL]]:
28+
// CHECK: [[EQUAL_TYPE:%[0-9]+]] = icmp eq i8* bitcast (%swift.type* @"$sSiN" to i8*), [[ERASED_TYPE]]
29+
// CHECK: [[EQUAL_TYPES:%[0-9]+]] = and i1 true, [[EQUAL_TYPE]]
30+
// CHECK: br i1 [[EQUAL_TYPES]], label %[[EXIT_PRESPECIALIZED:[0-9]+]], label %[[EXIT_NORMAL:[0-9]+]]
31+
// CHECK: [[EXIT_PRESPECIALIZED]]:
32+
// CHECK: ret %swift.metadata_response { %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5Value[[UNIQUE_ID_1]]VySiGMf" to %swift.full_type*), i32 0, i32 1), i64 0 }
33+
// CHECK: [[EXIT_NORMAL]]:
34+
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateGenericMetadata(i64 %0, i8* [[ERASED_TYPE]], i8* undef, i8* undef, %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8 }>* @"$s4main5Value[[UNIQUE_ID_1]]VMn" to %swift.type_descriptor*)) #{{[0-9]+}}
35+
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
36+
// CHECK: }
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// RUN: %swift -target %module-target-future -emit-ir -prespecialize-generic-metadata %s | %FileCheck %s
2+
3+
// CHECK: @"$s4main9NamespaceC5ValueVySi_GMf" = internal constant <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }> <{ i8** getelementptr inbounds (%swift.vwtable, %swift.vwtable* @"$s4main9NamespaceC5ValueVWV", 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 }>* @"$s4main9NamespaceC5ValueVMn" to %swift.type_descriptor*), %swift.type* @"$sSiN", i32 0, [4 x i8] zeroinitializer, i64 3 }>, align 8
4+
final class Namespace<Arg> {
5+
struct Value {
6+
let first: Arg
7+
}
8+
}
9+
10+
@inline(never)
11+
func consume<T>(_ t: T) {
12+
withExtendedLifetime(t) { t in
13+
}
14+
}
15+
16+
// CHECK: define hidden swiftcc void @"$s4main4doityyF"() #{{[0-9]+}} {
17+
// 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*, i32, [4 x i8], i64 }>* @"$s4main9NamespaceC5ValueVySi_GMf" to %swift.full_type*), i32 0, i32 1))
18+
// CHECK: }
19+
func doit() {
20+
consume( Namespace.Value(first: 13) )
21+
}
22+
doit()
23+
24+
// CHECK: ; Function Attrs: noinline nounwind readnone
25+
// CHECK: define hidden swiftcc %swift.metadata_response @"$s4main9NamespaceC5ValueVMa"(i64, %swift.type*) #{{[0-9]+}} {
26+
// CHECK: entry:
27+
// CHECK: [[ERASED_TYPE_1:%[0-9]+]] = bitcast %swift.type* %1 to i8*
28+
// CHECK: br label %[[TYPE_COMPARISON_1:[0-9]+]]
29+
// CHECK: [[TYPE_COMPARISON_1]]:
30+
// CHECK: [[EQUAL_TYPE_1_1:%[0-9]+]] = icmp eq i8* bitcast (%swift.type* @"$sSiN" to i8*), [[ERASED_TYPE_1]]
31+
// CHECK: [[EQUAL_TYPES_1_1:%[0-9]+]] = and i1 true, [[EQUAL_TYPE_1_1]]
32+
// CHECK: br i1 [[EQUAL_TYPES_1_1]], label %[[EXIT_PRESPECIALIZED_1:[0-9]+]], label %[[EXIT_NORMAL:[0-9]+]]
33+
// CHECK: [[EXIT_PRESPECIALIZED_1]]:
34+
// CHECK: ret %swift.metadata_response { %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main9NamespaceC5ValueVySi_GMf" to %swift.full_type*), i32 0, i32 1), i64 0 }
35+
// CHECK: [[EXIT_NORMAL]]:
36+
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateGenericMetadata(i64 %0, i8* [[ERASED_TYPE_1]], i8* undef, i8* undef, %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8 }>* @"$s4main9NamespaceC5ValueVMn" to %swift.type_descriptor*)) #{{[0-9]+}}
37+
// CHECK: ret %swift.metadata_response {{%[0-9]+}}
38+
// CHECK: }

test/IRGen/prespecialized-metadata/struct-inmodule-1argument-1conformance-1distinct_use.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func consume<T>(_ t: T) {
1515
}
1616

1717
// CHECK: define hidden swiftcc void @"$s4main4doityyF"() #{{[0-9]+}} {
18-
// CHECK: call swiftcc void @"$s4main7consumeyyxlF"(%swift.opaque* noalias nocapture %{{[0-9]+}}, %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*))
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))
1919
// CHECK: }
2020
func doit() {
2121
consume( Value(first: 13) )
@@ -33,7 +33,7 @@ doit()
3333
// CHECK: [[EQUAL_TYPES:%[0-9]+]] = and i1 true, [[EQUAL_TYPE]]
3434
// CHECK: br i1 [[EQUAL_TYPES]], label %[[EXIT_PRESPECIALIZED:[0-9]+]], label %[[EXIT_NORMAL:[0-9]+]]
3535
// CHECK: [[EXIT_PRESPECIALIZED]]:
36-
// CHECK: ret %swift.metadata_response { %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*), i64 0 }
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 }
3737
// CHECK: [[EXIT_NORMAL]]:
3838
// 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
3939
// CHECK: ret %swift.metadata_response {{%[0-9]+}}

test/IRGen/prespecialized-metadata/struct-inmodule-1argument-1distinct_use.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ func consume<T>(_ t: T) {
1212
}
1313

1414
// CHECK: define hidden swiftcc void @"$s4main4doityyF"() #{{[0-9]+}} {
15-
// CHECK: call swiftcc void @"$s4main7consumeyyxlF"(%swift.opaque* noalias nocapture %{{[0-9]+}}, %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*))
15+
// 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*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1))
1616
// CHECK: }
1717
func doit() {
1818
consume( Value(first: 13) )
@@ -29,7 +29,7 @@ doit()
2929
// CHECK: [[EQUAL_TYPES:%[0-9]+]] = and i1 true, [[EQUAL_TYPE]]
3030
// CHECK: br i1 [[EQUAL_TYPES]], label %[[EXIT_PRESPECIALIZED:[0-9]+]], label %[[EXIT_NORMAL:[0-9]+]]
3131
// CHECK: [[EXIT_PRESPECIALIZED]]:
32-
// CHECK: ret %swift.metadata_response { %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*), i64 0 }
32+
// CHECK: ret %swift.metadata_response { %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1), i64 0 }
3333
// CHECK: [[EXIT_NORMAL]]:
3434
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateGenericMetadata(i64 %0, i8* [[ERASED_TYPE]], i8* undef, i8* undef, %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8 }>* @"$s4main5ValueVMn" to %swift.type_descriptor*)) #{{[0-9]+}}
3535
// CHECK: ret %swift.metadata_response {{%[0-9]+}}

test/IRGen/prespecialized-metadata/struct-inmodule-1argument-2conformance-1distinct_use.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ func consume<T>(_ t: T) {
1717
}
1818

1919
// CHECK: define hidden swiftcc void @"$s4main4doityyF"() #{{[0-9]+}} {
20-
// CHECK: call swiftcc void @"$s4main7consumeyyxlF"(%swift.opaque* noalias nocapture %{{[0-9]+}}, %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*))
20+
// 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**, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1))
2121
// CHECK: }
2222
func doit() {
2323
consume( Value(first: 13) )
@@ -36,7 +36,7 @@ doit()
3636
// CHECK: [[EQUAL_TYPES:%[0-9]+]] = and i1 true, [[EQUAL_TYPE]]
3737
// CHECK: br i1 [[EQUAL_TYPES]], label %[[EXIT_PRESPECIALIZED:[0-9]+]], label %[[EXIT_NORMAL:[0-9]+]]
3838
// CHECK: [[EXIT_PRESPECIALIZED]]:
39-
// CHECK: ret %swift.metadata_response { %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*), i64 0 }
39+
// CHECK: ret %swift.metadata_response { %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1), i64 0 }
4040
// CHECK: [[EXIT_NORMAL]]:
4141
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateGenericMetadata(i64 %0, i8* [[ERASED_TYPE]], i8* [[ERASED_TABLE_1]], i8* [[ERASED_TABLE_2]], %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32 }>* @"$s4main5ValueVMn" to %swift.type_descriptor*)) #{{[0-9]+}}
4242
// CHECK: ret %swift.metadata_response {{%[0-9]+}}

test/IRGen/prespecialized-metadata/struct-inmodule-1argument-2distinct_use.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ func consume<T>(_ t: T) {
1313
}
1414

1515
// CHECK: define hidden swiftcc void @"$s4main4doityyF"() #{{[0-9]+}} {
16-
// CHECK: call swiftcc void @"$s4main7consumeyyxlF"(%swift.opaque* noalias nocapture %{{[0-9]+}}, %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*))
17-
// CHECK: call swiftcc void @"$s4main7consumeyyxlF"(%swift.opaque* noalias nocapture %{{[0-9]+}}, %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySdGMf", i32 0, i32 1) to %swift.type*))
16+
// 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*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1))
17+
// 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*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySdGMf" to %swift.full_type*), i32 0, i32 1))
1818
// CHECK: }
1919
func doit() {
2020
consume( Value(first: 13) )
@@ -36,9 +36,9 @@ doit()
3636
// CHECK: [[EQUAL_TYPES_2:%[0-9]+]] = and i1 true, [[EQUAL_TYPE_2]]
3737
// CHECK: br i1 [[EQUAL_TYPES_2]], label %[[EXIT_PRESPECIALIZED_2:[0-9]+]], label %[[EXIT_NORMAL:[0-9]+]]
3838
// CHECK: [[EXIT_PRESPECIALIZED_1]]:
39-
// CHECK: ret %swift.metadata_response { %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*), i64 0 }
39+
// CHECK: ret %swift.metadata_response { %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1), i64 0 }
4040
// CHECK: [[EXIT_PRESPECIALIZED_2]]:
41-
// CHECK: ret %swift.metadata_response { %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySdGMf", i32 0, i32 1) to %swift.type*), i64 0 }
41+
// CHECK: ret %swift.metadata_response { %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i32, [4 x i8], i64 }>* @"$s4main5ValueVySdGMf" to %swift.full_type*), i32 0, i32 1), i64 0 }
4242
// CHECK: [[EXIT_NORMAL]]:
4343
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @__swift_instantiateGenericMetadata(i64 %0, i8* [[ERASED_TYPE]], i8* undef, i8* undef, %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8 }>* @"$s4main5ValueVMn" to %swift.type_descriptor*)) #{{[0-9]+}}
4444
// CHECK: ret %swift.metadata_response {{%[0-9]+}}

test/IRGen/prespecialized-metadata/struct-inmodule-1argument-3conformance-1distinct_use.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func consume<T>(_ t: T) {
1919
}
2020

2121
// CHECK: define hidden swiftcc void @"$s4main4doityyF"() #{{[0-9]+}} {
22-
// CHECK: call swiftcc void @"$s4main7consumeyyxlF"(%swift.opaque* noalias nocapture %{{[0-9]+}}, %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i8**, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*))
22+
// 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**, i8**, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1))
2323
// CHECK: }
2424
func doit() {
2525
consume( Value(first: 13) )
@@ -38,7 +38,7 @@ doit()
3838
// CHECK: [[EQUAL_TYPES:%[0-9]+]] = and i1 true, [[EQUAL_TYPE]]
3939
// CHECK: br i1 [[EQUAL_TYPES]], label %[[EXIT_PRESPECIALIZED:[0-9]+]], label %[[EXIT_NORMAL:[0-9]+]]
4040
// CHECK: [[EXIT_PRESPECIALIZED]]:
41-
// CHECK: ret %swift.metadata_response { %swift.type* bitcast (i64* getelementptr inbounds (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i8**, i32, [4 x i8], i64 }>, <{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf", i32 0, i32 1) to %swift.type*), i64 0 }
41+
// CHECK: ret %swift.metadata_response { %swift.type* getelementptr inbounds (%swift.full_type, %swift.full_type* bitcast (<{ i8**, i64, %swift.type_descriptor*, %swift.type*, i8**, i8**, i8**, i32, [4 x i8], i64 }>* @"$s4main5ValueVySiGMf" to %swift.full_type*), i32 0, i32 1), i64 0 }
4242
// CHECK: [[EXIT_NORMAL]]:
4343
// CHECK: {{%[0-9]+}} = call swiftcc %swift.metadata_response @swift_getGenericMetadata(i64 %0, i8* [[ERASED_ARGUMENT_BUFFER]], %swift.type_descriptor* bitcast (<{ i32, i32, i32, i32, i32, i32, i32, i32, i32, i16, i16, i16, i16, i8, i8, i8, i8, i32, i32, i32, i32, i32, i32, i32, i32, i32 }>* @"$s4main5ValueVMn" to %swift.type_descriptor*)) #{{[0-9]+}}
4444
// CHECK: ret %swift.metadata_response {{%[0-9]+}}

0 commit comments

Comments
 (0)