Skip to content

Commit 1461827

Browse files
committed
Fix irgen test case that was disabled for a while
We now pass whether something is an existential meta type to swift_getDynamicType. SR3591
1 parent 6c4e2af commit 1461827

File tree

2 files changed

+211
-10
lines changed

2 files changed

+211
-10
lines changed

test/IRGen/generic_metatypes.swift

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,13 @@
44
// RUN: %swift -target i386-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
55
// RUN: %swift -target x86_64-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
66
// RUN: %swift -target i386-apple-watchos2.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
7-
// RUN: %swift -target armv7-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
8-
// RUN: %swift -target arm64-apple-ios7.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
9-
// RUN: %swift -target armv7-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
10-
// RUN: %swift -target arm64-apple-tvos9.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
11-
// RUN: %swift -target armv7k-apple-watchos2.0 -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
127
// RUN: %swift -target x86_64-unknown-linux-gnu -disable-objc-interop -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
138

149
// REQUIRES: CODEGENERATOR=X86
1510

16-
// FIXME: SR-3591 test is failing after being unintentionally disabled for a while
17-
// REQUIRES: SR3591
18-
1911
// CHECK: define hidden %swift.type* [[GENERIC_TYPEOF:@_TF17generic_metatypes13genericTypeof.*]](%swift.opaque* noalias nocapture, %swift.type* [[TYPE:%.*]])
2012
func genericTypeof<T>(_ x: T) -> T.Type {
21-
// CHECK: [[METATYPE:%.*]] = call %swift.type* @swift_getDynamicType(%swift.opaque* {{.*}}, %swift.type* [[TYPE]])
13+
// CHECK: [[METATYPE:%.*]] = call %swift.type* @swift_getDynamicType(%swift.opaque* {{.*}}, %swift.type* [[TYPE]], i1 false)
2214
// CHECK: ret %swift.type* [[METATYPE]]
2315
return type(of: x)
2416
}
@@ -65,7 +57,7 @@ func protocolTypeof(_ x: Bas) -> Bas.Type {
6557
// CHECK-64: [[PROJECT:%.*]] = bitcast i8* [[PROJECT_PTR]] to %swift.opaque* ([24 x i8]*, %swift.type*)*
6658
// CHECK-32: [[PROJECTION:%.*]] = call %swift.opaque* [[PROJECT]]([12 x i8]* [[BUFFER]], %swift.type* [[METADATA]])
6759
// CHECK-64: [[PROJECTION:%.*]] = call %swift.opaque* [[PROJECT]]([24 x i8]* [[BUFFER]], %swift.type* [[METADATA]])
68-
// CHECK: [[METATYPE:%.*]] = call %swift.type* @swift_getDynamicType(%swift.opaque* [[PROJECTION]], %swift.type* [[METADATA]])
60+
// CHECK: [[METATYPE:%.*]] = call %swift.type* @swift_getDynamicType(%swift.opaque* [[PROJECTION]], %swift.type* [[METADATA]], i1 true)
6961
// CHECK: [[T0:%.*]] = getelementptr inbounds %P17generic_metatypes3Bas_, %P17generic_metatypes3Bas_* [[X]], i32 0, i32 2
7062
// CHECK-32: [[WTABLE:%.*]] = load i8**, i8*** [[T0]], align 4
7163
// CHECK-64: [[WTABLE:%.*]] = load i8**, i8*** [[T0]], align 8
Lines changed: 209 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,209 @@
1+
// RUN: %swift -target armv7-apple-ios7.0 -module-name generic_metatypes -emit-ir -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
2+
// RUN: %swift -target arm64-apple-ios7.0 -emit-ir -module-name generic_metatypes -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
3+
// RUN: %swift -target armv7-apple-tvos9.0 -emit-ir -module-name generic_metatypes -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
4+
// RUN: %swift -target arm64-apple-tvos9.0 -emit-ir -module-name generic_metatypes -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-64 %s
5+
// RUN: %swift -target armv7k-apple-watchos2.0 -emit-ir -module-name generic_metatypes -parse-stdlib -primary-file %s | %FileCheck --check-prefix=CHECK --check-prefix=CHECK-32 %s
6+
7+
// REQUIRES: CODEGENERATOR=ARM
8+
9+
// CHECK: define hidden %swift.type* [[GENERIC_TYPEOF:@_TF17generic_metatypes13genericTypeof.*]](%swift.opaque* noalias nocapture, %swift.type* [[TYPE:%.*]])
10+
func genericTypeof<T>(_ x: T) -> T.Type {
11+
// CHECK: [[METATYPE:%.*]] = call %swift.type* @swift_getDynamicType(%swift.opaque* {{.*}}, %swift.type* [[TYPE]], i1 false)
12+
// CHECK: ret %swift.type* [[METATYPE]]
13+
return type(of: x)
14+
}
15+
16+
struct Foo {}
17+
class Bar {}
18+
19+
// CHECK: define hidden %swift.type* @_TF17generic_metatypes27remapToSubstitutedMetatypes{{.*}}(%C17generic_metatypes3Bar*) {{.*}} {
20+
func remapToSubstitutedMetatypes(_ x: Foo, y: Bar)
21+
-> (Foo.Type, Bar.Type)
22+
{
23+
// CHECK: call %swift.type* [[GENERIC_TYPEOF]](%swift.opaque* noalias nocapture undef, %swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}})
24+
// CHECK: [[T0:%.*]] = call %swift.type* @_TMaC17generic_metatypes3Bar()
25+
// CHECK: [[BAR_META:%.*]] = call %swift.type* [[GENERIC_TYPEOF]](%swift.opaque* noalias nocapture {{%.*}}, %swift.type* [[T0]])
26+
// CHECK: ret %swift.type* [[BAR_META]]
27+
return (genericTypeof(x), genericTypeof(y))
28+
}
29+
30+
31+
// CHECK: define hidden void @_TF17generic_metatypes23remapToGenericMetatypesFT_T_()
32+
func remapToGenericMetatypes() {
33+
// CHECK: [[T0:%.*]] = call %swift.type* @_TMaC17generic_metatypes3Bar()
34+
// CHECK: call void @_TF17generic_metatypes16genericMetatypes{{.*}}(%swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}} %swift.type* [[T0]], %swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}} %swift.type* [[T0]])
35+
genericMetatypes(Foo.self, Bar.self)
36+
}
37+
38+
func genericMetatypes<T, U>(_ t: T.Type, _ u: U.Type) {}
39+
40+
protocol Bas {}
41+
42+
// CHECK: define hidden { %swift.type*, i8** } @_TF17generic_metatypes14protocolTypeof{{.*}}(%P17generic_metatypes3Bas_* noalias nocapture dereferenceable({{.*}}))
43+
func protocolTypeof(_ x: Bas) -> Bas.Type {
44+
// CHECK: [[METADATA_ADDR:%.*]] = getelementptr inbounds %P17generic_metatypes3Bas_, %P17generic_metatypes3Bas_* [[X:%.*]], i32 0, i32 1
45+
// CHECK: [[METADATA:%.*]] = load %swift.type*, %swift.type** [[METADATA_ADDR]]
46+
// CHECK: [[BUFFER:%.*]] = getelementptr inbounds %P17generic_metatypes3Bas_, %P17generic_metatypes3Bas_* [[X]], i32 0, i32 0
47+
// CHECK: [[METADATA_I8:%.*]] = bitcast %swift.type* [[METADATA]] to i8***
48+
// CHECK-32: [[VW_ADDR:%.*]] = getelementptr inbounds i8**, i8*** [[METADATA_I8]], i32 -1
49+
// CHECK-64: [[VW_ADDR:%.*]] = getelementptr inbounds i8**, i8*** [[METADATA_I8]], i64 -1
50+
// CHECK: [[VW:%.*]] = load i8**, i8*** [[VW_ADDR]]
51+
// CHECK: [[PROJECT_ADDR:%.*]] = getelementptr inbounds i8*, i8** [[VW]], i32 2
52+
// CHECK-32: [[PROJECT_PTR:%.*]] = load i8*, i8** [[PROJECT_ADDR]], align 4
53+
// CHECK-64: [[PROJECT_PTR:%.*]] = load i8*, i8** [[PROJECT_ADDR]], align 8
54+
// CHECK-32: [[PROJECT:%.*]] = bitcast i8* [[PROJECT_PTR]] to %swift.opaque* ([12 x i8]*, %swift.type*)*
55+
// CHECK-64: [[PROJECT:%.*]] = bitcast i8* [[PROJECT_PTR]] to %swift.opaque* ([24 x i8]*, %swift.type*)*
56+
// CHECK-32: [[PROJECTION:%.*]] = call %swift.opaque* [[PROJECT]]([12 x i8]* [[BUFFER]], %swift.type* [[METADATA]])
57+
// CHECK-64: [[PROJECTION:%.*]] = call %swift.opaque* [[PROJECT]]([24 x i8]* [[BUFFER]], %swift.type* [[METADATA]])
58+
// CHECK: [[METATYPE:%.*]] = call %swift.type* @swift_getDynamicType(%swift.opaque* [[PROJECTION]], %swift.type* [[METADATA]], i1 true)
59+
// CHECK: [[T0:%.*]] = getelementptr inbounds %P17generic_metatypes3Bas_, %P17generic_metatypes3Bas_* [[X]], i32 0, i32 2
60+
// CHECK-32: [[WTABLE:%.*]] = load i8**, i8*** [[T0]], align 4
61+
// CHECK-64: [[WTABLE:%.*]] = load i8**, i8*** [[T0]], align 8
62+
// CHECK: [[T0:%.*]] = insertvalue { %swift.type*, i8** } undef, %swift.type* [[METATYPE]], 0
63+
// CHECK: [[T1:%.*]] = insertvalue { %swift.type*, i8** } [[T0]], i8** [[WTABLE]], 1
64+
// CHECK: ret { %swift.type*, i8** } [[T1]]
65+
return type(of: x)
66+
}
67+
68+
struct Zim : Bas {}
69+
class Zang : Bas {}
70+
71+
// CHECK-LABEL: define hidden { %swift.type*, i8** } @_TF17generic_metatypes15metatypeErasureFMVS_3ZimPMPS_3Bas_() #0
72+
func metatypeErasure(_ z: Zim.Type) -> Bas.Type {
73+
// CHECK: ret { %swift.type*, i8** } {{.*}} @_TMfV17generic_metatypes3Zim, {{.*}} @_TWPV17generic_metatypes3ZimS_3BasS_
74+
return z
75+
}
76+
77+
// CHECK-LABEL: define hidden { %swift.type*, i8** } @_TF17generic_metatypes15metatypeErasureFMCS_4ZangPMPS_3Bas_(%swift.type*) #0
78+
func metatypeErasure(_ z: Zang.Type) -> Bas.Type {
79+
// CHECK: [[RET:%.*]] = insertvalue { %swift.type*, i8** } undef, %swift.type* %0, 0
80+
// CHECK: [[RET2:%.*]] = insertvalue { %swift.type*, i8** } [[RET]], i8** getelementptr inbounds ([0 x i8*], [0 x i8*]* @_TWPC17generic_metatypes4ZangS_3BasS_, i32 0, i32 0), 1
81+
// CHECK: ret { %swift.type*, i8** } [[RET2]]
82+
return z
83+
}
84+
85+
struct OneArg<T> {}
86+
struct TwoArgs<T, U> {}
87+
struct ThreeArgs<T, U, V> {}
88+
struct FourArgs<T, U, V, W> {}
89+
struct FiveArgs<T, U, V, W, X> {}
90+
91+
func genericMetatype<A>(_ x: A.Type) {}
92+
93+
// CHECK-LABEL: define hidden void @_TF17generic_metatypes20makeGenericMetatypesFT_T_() {{.*}} {
94+
func makeGenericMetatypes() {
95+
// CHECK: call %swift.type* @_TMaGV17generic_metatypes6OneArgVS_3Foo_() [[NOUNWIND_READNONE:#[0-9]+]]
96+
genericMetatype(OneArg<Foo>.self)
97+
98+
// CHECK: call %swift.type* @_TMaGV17generic_metatypes7TwoArgsVS_3FooCS_3Bar_() [[NOUNWIND_READNONE]]
99+
genericMetatype(TwoArgs<Foo, Bar>.self)
100+
101+
// CHECK: call %swift.type* @_TMaGV17generic_metatypes9ThreeArgsVS_3FooCS_3BarS1__() [[NOUNWIND_READNONE]]
102+
genericMetatype(ThreeArgs<Foo, Bar, Foo>.self)
103+
104+
// CHECK: call %swift.type* @_TMaGV17generic_metatypes8FourArgsVS_3FooCS_3BarS1_S2__() [[NOUNWIND_READNONE]]
105+
genericMetatype(FourArgs<Foo, Bar, Foo, Bar>.self)
106+
107+
// CHECK: call %swift.type* @_TMaGV17generic_metatypes8FiveArgsVS_3FooCS_3BarS1_S2_S1__() [[NOUNWIND_READNONE]]
108+
genericMetatype(FiveArgs<Foo, Bar, Foo, Bar, Foo>.self)
109+
}
110+
111+
// CHECK: define linkonce_odr hidden %swift.type* @_TMaGV17generic_metatypes6OneArgVS_3Foo_() [[NOUNWIND_READNONE_OPT:#[0-9]+]]
112+
// CHECK: call %swift.type* @_TMaV17generic_metatypes6OneArg(%swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}}) [[NOUNWIND_READNONE:#[0-9]+]]
113+
114+
// CHECK-LABEL: define hidden %swift.type* @_TMaV17generic_metatypes6OneArg(%swift.type*)
115+
// CHECK: [[BUFFER:%.*]] = alloca { %swift.type* }
116+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type* }* [[BUFFER]] to i8*
117+
// CHECK: call void @llvm.lifetime.start
118+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type* }, { %swift.type* }* [[BUFFER]], i32 0, i32 0
119+
// CHECK: store %swift.type* %0, %swift.type** [[BUFFER_ELT]]
120+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type* }* [[BUFFER]] to i8*
121+
// CHECK: [[METADATA:%.*]] = call %swift.type* @swift_rt_swift_getGenericMetadata(%swift.type_pattern* {{.*}} @_TMPV17generic_metatypes6OneArg {{.*}}, i8* [[BUFFER_PTR]])
122+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type* }* [[BUFFER]] to i8*
123+
// CHECK: call void @llvm.lifetime.end
124+
// CHECK: ret %swift.type* [[METADATA]]
125+
126+
// CHECK: define linkonce_odr hidden %swift.type* @_TMaGV17generic_metatypes7TwoArgsVS_3FooCS_3Bar_() [[NOUNWIND_READNONE_OPT]]
127+
// CHECK: [[T0:%.*]] = call %swift.type* @_TMaC17generic_metatypes3Bar()
128+
// CHECK: call %swift.type* @_TMaV17generic_metatypes7TwoArgs(%swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}}, %swift.type* [[T0]])
129+
130+
// CHECK-LABEL: define hidden %swift.type* @_TMaV17generic_metatypes7TwoArgs(%swift.type*, %swift.type*)
131+
// CHECK: [[BUFFER:%.*]] = alloca { %swift.type*, %swift.type* }
132+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type* }* [[BUFFER]] to i8*
133+
// CHECK: call void @llvm.lifetime.start
134+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type* }, { %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 0
135+
// CHECK: store %swift.type* %0, %swift.type** [[BUFFER_ELT]]
136+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type* }, { %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 1
137+
// CHECK: store %swift.type* %1, %swift.type** [[BUFFER_ELT]]
138+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type* }* [[BUFFER]] to i8*
139+
// CHECK: [[METADATA:%.*]] = call %swift.type* @swift_rt_swift_getGenericMetadata(%swift.type_pattern* {{.*}} @_TMPV17generic_metatypes7TwoArgs {{.*}}, i8* [[BUFFER_PTR]])
140+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type* }* [[BUFFER]] to i8*
141+
// CHECK: call void @llvm.lifetime.end
142+
// CHECK: ret %swift.type* [[METADATA]]
143+
144+
// CHECK: define linkonce_odr hidden %swift.type* @_TMaGV17generic_metatypes9ThreeArgsVS_3FooCS_3BarS1__() [[NOUNWIND_READNONE_OPT]]
145+
// CHECK: [[T0:%.*]] = call %swift.type* @_TMaC17generic_metatypes3Bar()
146+
// CHECK: call %swift.type* @_TMaV17generic_metatypes9ThreeArgs(%swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}}, %swift.type* [[T0]], %swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}}) [[NOUNWIND_READNONE]]
147+
148+
// CHECK-LABEL: define hidden %swift.type* @_TMaV17generic_metatypes9ThreeArgs(%swift.type*, %swift.type*, %swift.type*)
149+
// CHECK: [[BUFFER:%.*]] = alloca { %swift.type*, %swift.type*, %swift.type* }
150+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]] to i8*
151+
// CHECK: call void @llvm.lifetime.start
152+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 0
153+
// CHECK: store %swift.type* %0, %swift.type** [[BUFFER_ELT]]
154+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 1
155+
// CHECK: store %swift.type* %1, %swift.type** [[BUFFER_ELT]]
156+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 2
157+
// CHECK: store %swift.type* %2, %swift.type** [[BUFFER_ELT]]
158+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]] to i8*
159+
// CHECK: [[METADATA:%.*]] = call %swift.type* @swift_rt_swift_getGenericMetadata(%swift.type_pattern* {{.*}} @_TMPV17generic_metatypes9ThreeArgs {{.*}}, i8* [[BUFFER_PTR]])
160+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]] to i8*
161+
// CHECK: call void @llvm.lifetime.end
162+
// CHECK: ret %swift.type* [[METADATA]]
163+
164+
// CHECK: define linkonce_odr hidden %swift.type* @_TMaGV17generic_metatypes8FourArgsVS_3FooCS_3BarS1_S2__() [[NOUNWIND_READNONE_OPT]]
165+
// CHECK: [[T0:%.*]] = call %swift.type* @_TMaC17generic_metatypes3Bar()
166+
// CHECK: call %swift.type* @_TMaV17generic_metatypes8FourArgs(%swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}}, %swift.type* [[T0]], %swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}}, %swift.type* [[T0]]) [[NOUNWIND_READNONE]]
167+
168+
// CHECK-LABEL: define hidden %swift.type* @_TMaV17generic_metatypes8FourArgs(%swift.type*, %swift.type*, %swift.type*, %swift.type*)
169+
// CHECK: [[BUFFER:%.*]] = alloca { %swift.type*, %swift.type*, %swift.type*, %swift.type* }
170+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]] to i8*
171+
// CHECK: call void @llvm.lifetime.start
172+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 0
173+
// CHECK: store %swift.type* %0, %swift.type** [[BUFFER_ELT]]
174+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 1
175+
// CHECK: store %swift.type* %1, %swift.type** [[BUFFER_ELT]]
176+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 2
177+
// CHECK: store %swift.type* %2, %swift.type** [[BUFFER_ELT]]
178+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 3
179+
// CHECK: store %swift.type* %3, %swift.type** [[BUFFER_ELT]]
180+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]] to i8*
181+
// CHECK: [[METADATA:%.*]] = call %swift.type* @swift_rt_swift_getGenericMetadata(%swift.type_pattern* {{.*}} @_TMPV17generic_metatypes8FourArgs {{.*}}, i8* [[BUFFER_PTR]])
182+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]] to i8*
183+
// CHECK: call void @llvm.lifetime.end
184+
// CHECK: ret %swift.type* [[METADATA]]
185+
186+
// CHECK: define linkonce_odr hidden %swift.type* @_TMaGV17generic_metatypes8FiveArgsVS_3FooCS_3BarS1_S2_S1__() [[NOUNWIND_READNONE_OPT]]
187+
// CHECK: [[T0:%.*]] = call %swift.type* @_TMaC17generic_metatypes3Bar()
188+
// CHECK: call %swift.type* @_TMaV17generic_metatypes8FiveArgs(%swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}}, %swift.type* [[T0]], %swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}}, %swift.type* [[T0]], %swift.type* {{.*}} @_TMfV17generic_metatypes3Foo, {{.*}}) [[NOUNWIND_READNONE]]
189+
190+
// CHECK-LABEL: define hidden %swift.type* @_TMaV17generic_metatypes8FiveArgs(%swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type*)
191+
// CHECK: [[BUFFER:%.*]] = alloca { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }
192+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]] to i8*
193+
// CHECK: call void @llvm.lifetime.start
194+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 0
195+
// CHECK: store %swift.type* %0, %swift.type** [[BUFFER_ELT]]
196+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 1
197+
// CHECK: store %swift.type* %1, %swift.type** [[BUFFER_ELT]]
198+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 2
199+
// CHECK: store %swift.type* %2, %swift.type** [[BUFFER_ELT]]
200+
// CHECK: [[BUFFER_ELT:%.*]] = getelementptr inbounds { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }, { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]], i32 0, i32 3
201+
// CHECK: store %swift.type* %3, %swift.type** [[BUFFER_ELT]]
202+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]] to i8*
203+
// CHECK: [[METADATA:%.*]] = call %swift.type* @swift_rt_swift_getGenericMetadata(%swift.type_pattern* {{.*}} @_TMPV17generic_metatypes8FiveArgs {{.*}}, i8* [[BUFFER_PTR]])
204+
// CHECK: [[BUFFER_PTR:%.*]] = bitcast { %swift.type*, %swift.type*, %swift.type*, %swift.type*, %swift.type* }* [[BUFFER]] to i8*
205+
// CHECK: call void @llvm.lifetime.end
206+
// CHECK: ret %swift.type* [[METADATA]]
207+
208+
// CHECK: attributes [[NOUNWIND_READNONE_OPT]] = { nounwind readnone "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "target-cpu"
209+
// CHECK: attributes [[NOUNWIND_READNONE]] = { nounwind readnone }

0 commit comments

Comments
 (0)