1 // RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -triple i386-linux -emit-llvm -o - %s | FileCheck %s --check-prefix=ITANIUM
2 // RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -triple x86_64-darwin -emit-llvm -o - %s | FileCheck %s --check-prefix=ITANIUM
3 // RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -triple arm64-ehabi -emit-llvm -o - %s | FileCheck %s --check-prefix=ITANIUM
4 // RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -triple i386-windows -emit-llvm -o - %s | FileCheck %s --check-prefix=MSABI --check-prefix=WIN32
5 // RUN: %clang_cc1 -no-enable-noundef-analysis -std=c++11 -triple x86_64-windows -emit-llvm -o - %s | FileCheck %s --check-prefix=MSABI --check-prefix=WIN64
7 // PR63618: make sure we generate definitions for all the globals defined in the test
8 // MSABI: @"?b@@3UB@@A" = {{.*}} zeroinitializer
9 // MSABI: @"?d@@3UD@@A" = {{.*}} zeroinitializer
10 // MSABI: @"?b@noninline_nonvirt@@3UB@1@A" = {{.*}} zeroinitializer
11 // MSABI: @"?c@noninline_nonvirt@@3UC@1@A" = {{.*}} zeroinitializer
12 // MSABI: @"?b@noninline_virt@@3UB@1@A" = {{.*}} zeroinitializer
13 // MSABI: @"?c@noninline_virt@@3UC@1@A" = {{.*}} zeroinitializer
14 // MSABI: @"?b@inalloca_nonvirt@@3UB@1@A" = {{.*}} zeroinitializer
15 // MSABI: @"?c@inalloca_nonvirt@@3UC@1@A" = {{.*}} zeroinitializer
16 // MSABI: @"?b@inalloca_virt@@3UB@1@A" = {{.*}} zeroinitializer
17 // MSABI: @"?c@inalloca_virt@@3UC@1@A" = {{.*}} zeroinitializer
18 // MSABI: @"?b@inline_nonvirt@@3UB@1@A" = {{.*}} zeroinitializer
19 // MSABI: @"?c@inline_nonvirt@@3UC@1@A" = {{.*}} zeroinitializer
20 // MSABI: @"?b@inline_virt@@3UB@1@A" = {{.*}} zeroinitializer
21 // MSABI: @"?c@inline_virt@@3UC@1@A" = {{.*}} zeroinitializer
26 struct A
{ A(int); virtual ~A(); };
27 struct B
: A
{ using A::A
; ~B(); };
32 struct C
{ template<typename T
> C(T
); };
33 struct D
: C
{ using C::C
; };
36 // ITANIUM-LABEL: define{{.*}} void @_ZN1BD2Ev
37 // ITANIUM-LABEL: define{{.*}} void @_ZN1BD1Ev
38 // ITANIUM-LABEL: define{{.*}} void @_ZN1BD0Ev
39 // WIN32-LABEL: define {{.*}}void @"??1B@@UAE@XZ"
40 // WIN64-LABEL: define {{.*}}void @"??1B@@UEAA@XZ"
42 // ITANIUM-LABEL: define linkonce_odr void @_ZN1BCI11AEi(
43 // ITANIUM: call void @_ZN1BCI21AEi(
45 // ITANIUM-LABEL: define linkonce_odr void @_ZN1DCI11CIiEET_(
46 // ITANIUM: call void @_ZN1DCI21CIiEET_(
48 // WIN32-LABEL: define internal {{.*}} @"??0B@@QAE@H@Z"(
49 // WIN32: call {{.*}} @"??0A@@QAE@H@Z"(
50 // WIN64-LABEL: define internal {{.*}} @"??0B@@QEAA@H@Z"(
51 // WIN64: call {{.*}} @"??0A@@QEAA@H@Z"(
53 // WIN32-LABEL: define internal {{.*}} @"??0D@@QAE@H@Z"(
54 // WIN32: call {{.*}} @"??$?0H@C@@QAE@H@Z"
55 // WIN64-LABEL: define internal {{.*}} @"??0D@@QEAA@H@Z"(
56 // WIN64: call {{.*}} @"??$?0H@C@@QEAA@H@Z"
58 struct Q
{ Q(int); Q(const Q
&); ~Q(); };
59 struct Z
{ Z(); Z(int); ~Z(); int n
; };
61 namespace noninline_nonvirt
{
62 struct A
{ A(int, Q
&&, void *__attribute__((pass_object_size(0)))); int n
; };
63 struct B
: Z
, A
{ Z z
; using A::A
; };
65 // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init
66 // ITANIUM: call void @_ZN1QC1Ei({{.*}} %[[TMP:.*]], i32 2)
67 // ITANIUM: call void @_ZN17noninline_nonvirt1BCI1NS_1AEEiO1QPvU17pass_object_size0({{.*}} @_ZN17noninline_nonvirt1bE, i32 1, {{.*}} %[[TMP]], ptr @_ZN17noninline_nonvirt1bE{{.*}}, i{{32|64}} 12)
68 // ITANIUM: call void @_ZN1QD1Ev({{.*}} %[[TMP]])
69 // ITANIUM: call i32 @__cxa_atexit(
71 // Complete object ctor for B delegates to base object ctor.
72 // ITANIUM-LABEL: define linkonce_odr void @_ZN17noninline_nonvirt1BCI1NS_1AEEiO1QPvU17pass_object_size0(
73 // ITANIUM: call void @_ZN17noninline_nonvirt1BCI2NS_1AEEiO1QPvU17pass_object_size0({{.*}}, i32 {{.*}}, ptr {{.*}}, ptr {{.*}}, i{{32|64}} {{.*}})
75 // In MSABI, we don't have ctor variants. B ctor forwards to A ctor.
76 // MSABI-LABEL: define internal {{.*}} @"??0B@noninline_nonvirt@@Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}}AXW4__pass_object_size0@__clang@@@Z"(ptr{{.*}}, i32{{.*}}, ptr{{.*}}, ptr{{.*}}, i{{32|64}}{{.*}})
77 // MSABI: call {{.*}} @"??0Z@@Q{{AE|EAA}}@XZ"(
78 // MSABI: call {{.*}} @"??0A@noninline_nonvirt@@Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}}AXW4__pass_object_size0@__clang@@@Z"(ptr{{.*}}, i32{{.*}}, ptr{{.*}}, ptr{{.*}}, i{{32|64}}{{.*}})
79 // MSABI: call {{.*}} @"??0Z@@Q{{AE|EAA}}@XZ"(
81 struct C
: B
{ using B::B
; };
83 // Complete object ctor for C delegates.
84 // ITANIUM-LABEL: define linkonce_odr void @_ZN17noninline_nonvirt1CCI1NS_1AEEiO1QPvU17pass_object_size0(
85 // ITANIUM: call void @_ZN17noninline_nonvirt1CCI2NS_1AEEiO1QPvU17pass_object_size0({{.*}}, i32 {{.*}}, ptr {{.*}}, ptr {{.*}}, i{{32|64}} {{.*}})
87 // MSABI-LABEL: define internal {{.*}} @"??0C@noninline_nonvirt@@Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}}AXW4__pass_object_size0@__clang@@@Z"(ptr{{.*}}, i32{{.*}}, ptr{{.*}}, ptr{{.*}}, i{{32|64}}{{.*}})
88 // MSABI: call {{.*}} @"??0B@noninline_nonvirt@@Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}}AXW4__pass_object_size0@__clang@@@Z"(ptr{{.*}}, i32{{.*}}, ptr{{.*}}, ptr{{.*}}, i{{32|64}}{{.*}})
91 namespace noninline_virt
{
92 struct A
{ A(int, Q
&&, void *__attribute__((pass_object_size(0)))); int n
; };
93 struct B
: Z
, virtual A
{ Z z
; using A::A
; };
95 // Complete object ctor forwards to A ctor then constructs Zs.
96 // ITANIUM-LABEL: define linkonce_odr void @_ZN14noninline_virt1BCI1NS_1AEEiO1QPvU17pass_object_size0(
97 // ITANIUM: call void @_ZN14noninline_virt1AC2EiO1QPvU17pass_object_size0({{.*}} %{{.*}}, i32 %{{.*}}, ptr {{.*}}, ptr {{.*}}, i{{32|64}} %{{.*}}
98 // ITANIUM: call void @_ZN1ZC2Ev(
99 // ITANIUM: store {{.*}} @_ZTVN14noninline_virt1BE
100 // ITANIUM: call void @_ZN1ZC1Ev(
102 // MSABI-LABEL: define internal {{.*}} @"??0B@noninline_virt@@Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}}AXW4__pass_object_size0@__clang@@@Z"(ptr{{.*}}, i32{{.*}}, ptr{{.*}}, ptr{{.*}}, i{{32|64}}{{.*}}, i32 %{{.*}})
103 // MSABI: %[[COMPLETE:.*]] = icmp ne
104 // MSABI: br i1 %[[COMPLETE]],
105 // MSABI: call {{.*}} @"??0A@noninline_virt@@Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}}AXW4__pass_object_size0@__clang@@@Z"(ptr{{.*}}, i32{{.*}}, ptr{{.*}}, ptr{{.*}}, i{{32|64}}{{.*}})
107 // MSABI: call {{.*}} @"??0Z@@Q{{AE|EAA}}@XZ"(
108 // MSABI: call {{.*}} @"??0Z@@Q{{AE|EAA}}@XZ"(
110 struct C
: B
{ using B::B
; };
112 // Complete object ctor forwards to A ctor, then calls B's base inheriting
113 // constructor, which takes no arguments other than the this pointer and VTT.
114 // ITANIUM-LABEL: define linkonce_odr void @_ZN14noninline_virt1CCI1NS_1AEEiO1QPvU17pass_object_size0(
115 // ITANIUM: call void @_ZN14noninline_virt1AC2EiO1QPvU17pass_object_size0({{.*}} %{{.*}}, i32 %{{.*}}, ptr {{.*}}, ptr %{{.*}}, i{{32|64}} %{{.*}})
116 // ITANIUM: call void @_ZN14noninline_virt1BCI2NS_1AEEiO1QPvU17pass_object_size0(ptr {{[^,]*}} %{{.*}}, ptr getelementptr inbounds ([2 x ptr], ptr @_ZTTN14noninline_virt1CE, i64 0, i64 1))
117 // ITANIUM: store {{.*}} @_ZTVN14noninline_virt1CE
119 // C constructor forwards to B constructor and A constructor. We pass the args
120 // to both. FIXME: Can we pass undef here instead, for the base object
122 // MSABI-LABEL: define internal {{.*}} @"??0C@noninline_virt@@Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}}AXW4__pass_object_size0@__clang@@@Z"(ptr{{.*}}, i32{{.*}}, ptr{{.*}}, ptr{{.*}}, i{{32|64}}{{.*}}, i32 %{{.*}})
123 // MSABI: %[[COMPLETE:.*]] = icmp ne
124 // MSABI: br i1 %[[COMPLETE]],
125 // MSABI: call {{.*}} @"??0A@noninline_virt@@Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}}AXW4__pass_object_size0@__clang@@@Z"(ptr{{.*}}, i32{{.*}}, ptr{{.*}}, ptr{{.*}}, i{{32|64}}{{.*}})
127 // MSABI: call {{.*}} @"??0B@noninline_virt@@Q{{AE|EAA}}@H$$Q{{E?}}AUQ@@P{{E?}}AXW4__pass_object_size0@__clang@@@Z"(ptr{{.*}}, i32{{.*}}, ptr{{.*}}, ptr{{.*}}, i{{32|64}}{{.*}}, i32 0)
130 // For MSABI only, check that inalloca arguments result in inlining.
131 namespace inalloca_nonvirt
{
132 struct A
{ A(Q
, int, Q
, Q
&&); int n
; };
133 struct B
: Z
, A
{ Z z
; using A::A
; };
135 // No inlining implied for Itanium.
136 // ITANIUM-LABEL: define linkonce_odr void @_ZN16inalloca_nonvirt1BCI1NS_1AEE1QiS1_OS1_(
137 // ITANIUM: call void @_ZN16inalloca_nonvirt1BCI2NS_1AEE1QiS1_OS1_(
139 // MSABI-LABEL: define internal void @"??__Eb@inalloca_nonvirt@@YAXXZ"(
141 // On Win32, the inalloca call can't be forwarded so we force inlining.
142 // WIN32: %[[TMP:.*]] = alloca
143 // WIN32: call ptr @llvm.stacksave.p0()
144 // WIN32: %[[ARGMEM:.*]] = alloca inalloca
145 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[TMP]], i32 4)
146 // WIN32: %[[ARG3:.*]] = getelementptr {{.*}} %[[ARGMEM]]
147 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[ARG3]], i32 3)
148 // WIN32: %[[ARG1:.*]] = getelementptr {{.*}} %[[ARGMEM]]
149 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[ARG1]], i32 1)
150 // WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
151 // WIN32: %[[ARG2:.*]] = getelementptr {{.*}} %[[ARGMEM]]
152 // WIN32: store i32 2, ptr %[[ARG2]]
153 // WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]
154 // WIN32: store ptr %[[TMP]], ptr %[[ARG4]]
155 // WIN32: call {{.*}} @"??0A@inalloca_nonvirt@@QAE@UQ@@H0$$QAU2@@Z"(ptr{{[^,]*}}, ptr inalloca(<{{.*}}>) %[[ARGMEM]])
156 // WIN32: call void @llvm.stackrestore.p0(
157 // WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
158 // WIN32: call {{.*}} @"??1Q@@QAE@XZ"(
160 // On Win64, the Q arguments would be destroyed in the callee. We don't yet
161 // support that in the non-inlined case, so we force inlining.
162 // WIN64: %[[TMP:.*]] = alloca
163 // WIN64: %[[ARG3:.*]] = alloca
164 // WIN64: %[[ARG1:.*]] = alloca
165 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[TMP]], i32 4)
166 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[ARG3]], i32 3)
167 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[ARG1]], i32 1)
168 // WIN64: call {{.*}} @"??0Z@@QEAA@XZ"(
169 // WIN64: call {{.*}} @"??0A@inalloca_nonvirt@@QEAA@UQ@@H0$$QEAU2@@Z"(ptr{{.*}}, ptr %[[ARG1]], i32 2, ptr %[[ARG3]], ptr{{.*}} %[[TMP]])
170 // WIN64: call {{.*}} @"??0Z@@QEAA@XZ"(
171 // WIN64: call void @"??1Q@@QEAA@XZ"(ptr {{[^,]*}} %[[TMP]])
173 struct C
: B
{ using B::B
; };
175 // MSABI-LABEL: define internal void @"??__Ec@inalloca_nonvirt@@YAXXZ"(
177 // On Win32, the inalloca call can't be forwarded so we force inlining.
178 // WIN32: %[[TMP:.*]] = alloca
179 // WIN32: call ptr @llvm.stacksave.p0()
180 // WIN32: %[[ARGMEM:.*]] = alloca inalloca
181 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[TMP]], i32 4)
182 // WIN32: %[[ARG3:.*]] = getelementptr {{.*}} %[[ARGMEM]]
183 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[ARG3]], i32 3)
184 // WIN32: %[[ARG1:.*]] = getelementptr {{.*}} %[[ARGMEM]]
185 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[ARG1]], i32 1)
186 // WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
187 // WIN32: %[[ARG2:.*]] = getelementptr {{.*}} %[[ARGMEM]]
188 // WIN32: store i32 2, ptr %[[ARG2]]
189 // WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]
190 // WIN32: store ptr %[[TMP]], ptr %[[ARG4]]
191 // WIN32: call {{.*}} @"??0A@inalloca_nonvirt@@QAE@UQ@@H0$$QAU2@@Z"(ptr{{[^,]*}}, ptr inalloca(<{{.*}}>) %[[ARGMEM]])
192 // WIN32: call void @llvm.stackrestore.p0(
193 // WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
194 // WIN32: call {{.*}} @"??1Q@@QAE@XZ"(
196 // On Win64, the Q arguments would be destroyed in the callee. We don't yet
197 // support that in the non-inlined case, so we force inlining.
198 // WIN64: %[[TMP:.*]] = alloca
199 // WIN64: %[[ARG3:.*]] = alloca
200 // WIN64: %[[ARG1:.*]] = alloca
201 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[TMP]], i32 4)
202 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[ARG3]], i32 3)
203 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[ARG1]], i32 1)
204 // WIN64: call {{.*}} @"??0Z@@QEAA@XZ"(
205 // WIN64: call {{.*}} @"??0A@inalloca_nonvirt@@QEAA@UQ@@H0$$QEAU2@@Z"(ptr{{.*}}, ptr %[[ARG1]], i32 2, ptr %[[ARG3]], ptr{{.*}} %[[TMP]])
206 // WIN64: call {{.*}} @"??0Z@@QEAA@XZ"(
207 // WIN64: call void @"??1Q@@QEAA@XZ"(ptr {{[^,]*}} %[[TMP]])
210 namespace inalloca_virt
{
211 struct A
{ A(Q
, int, Q
, Q
&&); int n
; };
212 struct B
: Z
, virtual A
{ Z z
; using A::A
; };
215 // MSABI-LABEL: define internal void @"??__Eb@inalloca_virt@@YAXXZ"(
217 // On Win32, the inalloca call can't be forwarded so we force inlining.
218 // WIN32: %[[TMP:.*]] = alloca
219 // WIN32: call ptr @llvm.stacksave.p0()
220 // WIN32: %[[ARGMEM:.*]] = alloca inalloca
221 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[TMP]], i32 4)
222 // WIN32: %[[ARG3:.*]] = getelementptr {{.*}} %[[ARGMEM]]
223 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[ARG3]], i32 3)
224 // WIN32: %[[ARG1:.*]] = getelementptr {{.*}} %[[ARGMEM]]
225 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[ARG1]], i32 1)
226 // FIXME: It's dumb to round-trip this though memory and generate a branch.
227 // WIN32: store i32 1, ptr %[[IS_MOST_DERIVED_ADDR:.*]]
228 // WIN32: %[[IS_MOST_DERIVED:.*]] = load i32, ptr %[[IS_MOST_DERIVED_ADDR]]
229 // WIN32: %[[IS_MOST_DERIVED_i1:.*]] = icmp ne i32 %[[IS_MOST_DERIVED]], 0
230 // WIN32: br i1 %[[IS_MOST_DERIVED_i1]]
232 // WIN32: store {{.*}} @"??_8B@inalloca_virt@@7B@"
233 // WIN32: %[[ARG2:.*]] = getelementptr {{.*}} %[[ARGMEM]]
234 // WIN32: store i32 2, ptr %[[ARG2]]
235 // WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]
236 // WIN32: store ptr %[[TMP]], ptr %[[ARG4]]
237 // WIN32: call {{.*}} @"??0A@inalloca_virt@@QAE@UQ@@H0$$QAU2@@Z"(ptr{{[^,]*}}, ptr inalloca(<{{.*}}>) %[[ARGMEM]])
238 // WIN32: call void @llvm.stackrestore.p0(
241 // Note that if we jumped directly to here we would fail to stackrestore and
242 // destroy the parameters, but that's not actually possible.
243 // WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
244 // WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
245 // WIN32: call {{.*}} @"??1Q@@QAE@XZ"(
247 // On Win64, the Q arguments would be destroyed in the callee. We don't yet
248 // support that in the non-inlined case, so we force inlining.
249 // WIN64: %[[TMP:.*]] = alloca
250 // WIN64: %[[ARG3:.*]] = alloca
251 // WIN64: %[[ARG1:.*]] = alloca
252 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[TMP]], i32 4)
253 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[ARG3]], i32 3)
254 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[ARG1]], i32 1)
256 // WIN64: call {{.*}} @"??0A@inalloca_virt@@QEAA@UQ@@H0$$QEAU2@@Z"(ptr{{.*}}, ptr %[[ARG1]], i32 2, ptr %[[ARG3]], ptr{{.*}} %[[TMP]])
258 // WIN64: call {{.*}} @"??0Z@@QEAA@XZ"(
259 // WIN64: call {{.*}} @"??0Z@@QEAA@XZ"(
260 // WIN64: call void @"??1Q@@QEAA@XZ"(ptr {{[^,]*}} %[[TMP]])
262 struct C
: B
{ using B::B
; };
264 // ITANIUM-LABEL: define linkonce_odr void @_ZN13inalloca_virt1CD1Ev(
266 // MSABI-LABEL: define internal void @"??__Ec@inalloca_virt@@YAXXZ"(
268 // On Win32, the inalloca call can't be forwarded so we force inlining.
269 // WIN32: %[[TMP:.*]] = alloca
270 // WIN32: call ptr @llvm.stacksave.p0()
271 // WIN32: %[[ARGMEM:.*]] = alloca inalloca
272 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[TMP]], i32 4)
273 // WIN32: %[[ARG3:.*]] = getelementptr {{.*}} %[[ARGMEM]]
274 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[ARG3]], i32 3)
275 // WIN32: %[[ARG1:.*]] = getelementptr {{.*}} %[[ARGMEM]]
276 // WIN32: call {{.*}} @"??0Q@@QAE@H@Z"(ptr {{[^,]*}} %[[ARG1]], i32 1)
277 // WIN32: store i32 1, ptr %[[IS_MOST_DERIVED_ADDR:.*]]
278 // WIN32: %[[IS_MOST_DERIVED:.*]] = load i32, ptr %[[IS_MOST_DERIVED_ADDR]]
279 // WIN32: %[[IS_MOST_DERIVED_i1:.*]] = icmp ne i32 %[[IS_MOST_DERIVED]], 0
280 // WIN32: br i1 %[[IS_MOST_DERIVED_i1]]
282 // WIN32: store {{.*}} @"??_8C@inalloca_virt@@7B@"
283 // WIN32: %[[ARG2:.*]] = getelementptr {{.*}} %[[ARGMEM]]
284 // WIN32: store i32 2, ptr %[[ARG2]]
285 // WIN32: %[[ARG4:.*]] = getelementptr {{.*}} %[[ARGMEM]]
286 // WIN32: store ptr %[[TMP]], ptr %[[ARG4]]
287 // WIN32: call {{.*}} @"??0A@inalloca_virt@@QAE@UQ@@H0$$QAU2@@Z"(ptr{{[^,]*}}, ptr inalloca(<{{.*}}>) %[[ARGMEM]])
288 // WIN32: call void @llvm.stackrestore.p0(
291 // WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
292 // WIN32: call {{.*}} @"??0Z@@QAE@XZ"(
293 // WIN32: call {{.*}} @"??1Q@@QAE@XZ"(
295 // On Win64, the Q arguments would be destroyed in the callee. We don't yet
296 // support that in the non-inlined case, so we force inlining.
297 // WIN64: %[[TMP:.*]] = alloca
298 // WIN64: %[[ARG3:.*]] = alloca
299 // WIN64: %[[ARG1:.*]] = alloca
300 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[TMP]], i32 4)
301 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[ARG3]], i32 3)
302 // WIN64: call {{.*}} @"??0Q@@QEAA@H@Z"(ptr {{[^,]*}} %[[ARG1]], i32 1)
304 // WIN64: store {{.*}} @"??_8C@inalloca_virt@@7B@"
305 // WIN64: call {{.*}} @"??0A@inalloca_virt@@QEAA@UQ@@H0$$QEAU2@@Z"(ptr{{.*}}, ptr %[[ARG1]], i32 2, ptr %[[ARG3]], ptr{{.*}} %[[TMP]])
306 // WIN64: call {{.*}} @"??0Z@@QEAA@XZ"(
307 // WIN64: call {{.*}} @"??0Z@@QEAA@XZ"(
308 // WIN64: call void @"??1Q@@QEAA@XZ"(ptr {{[^,]*}} %[[TMP]])
311 namespace inline_nonvirt
{
312 struct A
{ A(Q
, int, Q
, Q
&&, ...); int n
; };
313 struct B
: Z
, A
{ Z z
; using A::A
; };
314 B
b(1, 2, 3, 4, 5, 6);
315 // Inlined all the way down to the A ctor.
316 // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init
317 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 1)
318 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 3)
319 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 4)
320 // ITANIUM: call void @_ZN1ZC2Ev(
321 // ITANIUM: %[[A:.*]] = getelementptr {{.*}}, i{{32|64}} 4
322 // ITANIUM: call void ({{.*}}, ...) @_ZN14inline_nonvirt1AC2E1QiS1_OS1_z(ptr {{[^,]*}} %[[A]], {{.*}}, i32 2, {{.*}}, {{.*}}, i32 5, i32 6)
323 // ITANIUM: %[[Z_MEMBER:.*]] = getelementptr {{.*}}, i32 0, i32 2
324 // ITANIUM: call void @_ZN1ZC1Ev({{.*}} %[[Z_MEMBER]])
325 // ITANIUM: call void @_ZN1QD1Ev(
326 // ITANIUM: call void @_ZN1QD1Ev(
327 // ITANIUM: call void @_ZN1QD1Ev(
329 struct C
: B
{ using B::B
; };
330 C
c(1, 2, 3, 4, 5, 6);
331 // Inlined all the way down to the A ctor.
332 // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init
333 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 1)
334 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 3)
335 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 4)
336 // ITANIUM: call void @_ZN1ZC2Ev(
337 // ITANIUM: %[[A:.*]] = getelementptr {{.*}}, i{{32|64}} 4
338 // ITANIUM: call void ({{.*}}, ...) @_ZN14inline_nonvirt1AC2E1QiS1_OS1_z(ptr {{[^,]*}} %[[A]], {{.*}}, i32 2, {{.*}}, {{.*}}, i32 5, i32 6)
339 // ITANIUM: %[[Z_MEMBER:.*]] = getelementptr {{.*}} %{{.*}}, i32 0, i32 2
340 // ITANIUM: call void @_ZN1ZC1Ev({{.*}} %[[Z_MEMBER]])
341 // ITANIUM: call void @_ZN1QD1Ev(
342 // ITANIUM: call void @_ZN1QD1Ev(
343 // ITANIUM: call void @_ZN1QD1Ev(
346 namespace inline_virt
{
347 struct A
{ A(Q
, int, Q
, Q
&&, ...); int n
; };
348 struct B
: Z
, virtual A
{ Z z
; using A::A
; };
349 B
b(1, 2, 3, 4, 5, 6);
350 // Inlined all the way down to the A ctor.
351 // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init
352 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 1)
353 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 3)
354 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 4)
355 // ITANIUM: %[[A:.*]] = getelementptr {{.*}}, i{{32|64}} {{12|16}}
356 // ITANIUM: call void ({{.*}}, ...) @_ZN11inline_virt1AC2E1QiS1_OS1_z(ptr {{[^,]*}} %[[A]], {{.*}}, i32 2, {{.*}}, {{.*}}, i32 5, i32 6)
357 // ITANIUM: call void @_ZN1ZC2Ev(
358 // ITANIUM: call void @_ZN1ZC1Ev(
359 // ITANIUM: call void @_ZN1QD1Ev(
360 // ITANIUM: call void @_ZN1QD1Ev(
361 // ITANIUM: call void @_ZN1QD1Ev(
363 struct C
: B
{ using B::B
; };
364 C
c(1, 2, 3, 4, 5, 6);
365 // Inlined all the way down to the A ctor, except that we can just call the
366 // B base inheriting constructor to construct that portion (it doesn't need
367 // the forwarded arguments).
368 // ITANIUM-LABEL: define {{.*}} @__cxx_global_var_init
369 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 1)
370 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 3)
371 // ITANIUM: call void @_ZN1QC1Ei({{.*}}, i32 4)
372 // ITANIUM: %[[A:.*]] = getelementptr {{.*}}, i{{32|64}} {{12|16}}
373 // ITANIUM: call void ({{.*}}, ...) @_ZN11inline_virt1AC2E1QiS1_OS1_z(ptr {{[^,]*}} %[[A]], {{.*}}, i32 2, {{.*}}, {{.*}}, i32 5, i32 6)
374 // ITANIUM: call void @_ZN11inline_virt1BCI2NS_1AEE1QiS1_OS1_z({{[^,]*}}, ptr getelementptr inbounds ([2 x ptr], ptr @_ZTTN11inline_virt1CE, i64 0, i64 1))
375 // ITANIUM: store {{.*}} @_ZTVN11inline_virt1CE
376 // ITANIUM: call void @_ZN1QD1Ev(
377 // ITANIUM: call void @_ZN1QD1Ev(
378 // ITANIUM: call void @_ZN1QD1Ev(
380 // B base object inheriting constructor does not get passed arguments.
381 // ITANIUM-LABEL: define linkonce_odr void @_ZN11inline_virt1BCI2NS_1AEE1QiS1_OS1_z(
383 // ITANIUM: call void @_ZN1ZC2Ev(
388 // ITANIUM: call void @_ZN1ZC1Ev(
393 // ITANIUM-LABEL: define linkonce_odr void @_ZN1BCI21AEi(
394 // ITANIUM: call void @_ZN1AC2Ei(
396 // ITANIUM-LABEL: define linkonce_odr void @_ZN1DCI21CIiEET_(
397 // ITANIUM: call void @_ZN1CC2IiEET_(
399 // ITANIUM-LABEL: define linkonce_odr void @_ZN17noninline_nonvirt1BCI2NS_1AEEiO1QPvU17pass_object_size0(
400 // ITANIUM: call void @_ZN1ZC2Ev(
401 // ITANIUM: call void @_ZN17noninline_nonvirt1AC2EiO1QPvU17pass_object_size0(
403 // ITANIUM-LABEL: define linkonce_odr void @_ZN17noninline_nonvirt1CCI2NS_1AEEiO1QPvU17pass_object_size0(
404 // ITANIUM: call void @_ZN17noninline_nonvirt1BCI2NS_1AEEiO1QPvU17pass_object_size0(