Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CodeGenCXX / cxx0x-initializer-stdinitializerlist.cpp
blobd97a9310cdcfa20d3daee77968d0939574ab5b16
1 // RUN: %clang_cc1 -std=c++11 -triple x86_64-none-linux-gnu -fmerge-all-constants -emit-llvm -o - %s | FileCheck -check-prefixes=X86,CHECK %s
2 // RUN: %clang_cc1 -std=c++11 -triple amdgcn-amd-amdhsa -DNO_TLS -fmerge-all-constants -emit-llvm -o - %s | FileCheck -check-prefixes=AMDGCN,CHECK %s
4 namespace std {
5 typedef decltype(sizeof(int)) size_t;
7 // libc++'s implementation
8 template <class _E>
9 class initializer_list
11 const _E* __begin_;
12 size_t __size_;
14 initializer_list(const _E* __b, size_t __s)
15 : __begin_(__b),
16 __size_(__s)
19 public:
20 typedef _E value_type;
21 typedef const _E& reference;
22 typedef const _E& const_reference;
23 typedef size_t size_type;
25 typedef const _E* iterator;
26 typedef const _E* const_iterator;
28 initializer_list() : __begin_(nullptr), __size_(0) {}
30 size_t size() const {return __size_;}
31 const _E* begin() const {return __begin_;}
32 const _E* end() const {return __begin_ + __size_;}
36 struct destroyme1 {
37 ~destroyme1();
39 struct destroyme2 {
40 ~destroyme2();
42 struct witharg1 {
43 witharg1(const destroyme1&);
44 ~witharg1();
46 struct wantslist1 {
47 wantslist1(std::initializer_list<destroyme1>);
48 ~wantslist1();
50 // X86: @_ZGR15globalInitList1_ = internal constant [3 x i32] [i32 1, i32 2, i32 3]
51 // X86: @globalInitList1 ={{.*}} global %{{[^ ]+}} { ptr @_ZGR15globalInitList1_, i{{32|64}} 3 }
52 // AMDGCN: @_ZGR15globalInitList1_ = internal addrspace(1) constant [3 x i32] [i32 1, i32 2, i32 3]
53 // AMDGCN: @globalInitList1 ={{.*}} addrspace(1) global %{{[^ ]+}} { ptr addrspacecast (ptr addrspace(1) @_ZGR15globalInitList1_ to ptr), i{{32|64}} 3 }
54 std::initializer_list<int> globalInitList1 = {1, 2, 3};
56 #ifndef NO_TLS
57 namespace thread_local_global_array {
58 // FIXME: We should be able to constant-evaluate this even though the
59 // initializer is not a constant expression (pointers to thread_local
60 // objects aren't really a problem).
62 // X86: @_ZN25thread_local_global_array1xE ={{.*}} thread_local global
63 // X86: @_ZGRN25thread_local_global_array1xE_ = internal thread_local constant [4 x i32] [i32 1, i32 2, i32 3, i32 4]
64 std::initializer_list<int> thread_local x = {1, 2, 3, 4};
66 #endif
68 // X86: @globalInitList2 ={{.*}} global %{{[^ ]+}} zeroinitializer
69 // X86: @_ZGR15globalInitList2_ = internal global [2 x %[[WITHARG:[^ ]*]]] zeroinitializer
70 // AMDGCN: @globalInitList2 ={{.*}} addrspace(1) global %{{[^ ]+}} zeroinitializer
71 // AMDGCN: @_ZGR15globalInitList2_ = internal addrspace(1) global [2 x %[[WITHARG:[^ ]*]]] zeroinitializer
73 // X86: @_ZN15partly_constant1kE ={{.*}} global i32 0, align 4
74 // X86: @_ZN15partly_constant2ilE ={{.*}} global {{.*}} null, align 8
75 // X86: @[[PARTLY_CONSTANT_OUTER:_ZGRN15partly_constant2ilE_]] = internal global {{.*}} zeroinitializer, align 8
76 // X86: @[[PARTLY_CONSTANT_INNER:_ZGRN15partly_constant2ilE0_]] = internal global [3 x {{.*}}] zeroinitializer, align 8
77 // X86: @[[PARTLY_CONSTANT_FIRST:_ZGRN15partly_constant2ilE1_]] = internal constant [3 x i32] [i32 1, i32 2, i32 3], align 4
78 // X86: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE2_]] = internal global [2 x i32] zeroinitializer, align 4
79 // X86: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE3_]] = internal constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
80 // AMDGCN: @_ZN15partly_constant1kE ={{.*}} addrspace(1) global i32 0, align 4
81 // AMDGCN: @_ZN15partly_constant2ilE ={{.*}} addrspace(1) global {{.*}} null, align 8
82 // AMDGCN: @[[PARTLY_CONSTANT_OUTER:_ZGRN15partly_constant2ilE_]] = internal addrspace(1) global {{.*}} zeroinitializer, align 8
83 // AMDGCN: @[[PARTLY_CONSTANT_INNER:_ZGRN15partly_constant2ilE0_]] = internal addrspace(1) global [3 x {{.*}}] zeroinitializer, align 8
84 // AMDGCN: @[[PARTLY_CONSTANT_FIRST:_ZGRN15partly_constant2ilE1_]] = internal addrspace(1) constant [3 x i32] [i32 1, i32 2, i32 3], align 4
85 // AMDGCN: @[[PARTLY_CONSTANT_SECOND:_ZGRN15partly_constant2ilE2_]] = internal addrspace(1) global [2 x i32] zeroinitializer, align 4
86 // AMDGCN: @[[PARTLY_CONSTANT_THIRD:_ZGRN15partly_constant2ilE3_]] = internal addrspace(1) constant [4 x i32] [i32 5, i32 6, i32 7, i32 8], align 4
88 // X86: @[[REFTMP1:.*]] = private constant [2 x i32] [i32 42, i32 43], align 4
89 // X86: @[[REFTMP2:.*]] = private constant [3 x %{{.*}}] [%{{.*}} { i32 1 }, %{{.*}} { i32 2 }, %{{.*}} { i32 3 }], align 4
90 // AMDGCN: @[[REFTMP1:.*]] = private addrspace(4) constant [2 x i32] [i32 42, i32 43], align 4
91 // AMDGCN: @[[REFTMP2:.*]] = private addrspace(4) constant [3 x %{{.*}}] [%{{.*}} { i32 1 }, %{{.*}} { i32 2 }, %{{.*}} { i32 3 }], align 4
93 // CHECK: appending global
95 // thread_local initializer:
96 // X86-LABEL: define internal void @__cxx_global_var_init
97 // X86: [[ADDR:%.*]] = call {{.*}} ptr @llvm.threadlocal.address.p0(ptr {{.*}} @_ZN25thread_local_global_array1xE)
98 // X86: store ptr @_ZGRN25thread_local_global_array1xE_, ptr [[ADDR]], align 8
99 // X86: store i64 4, ptr getelementptr inbounds ({{.*}}, ptr @_ZN25thread_local_global_array1xE, i32 0, i32 1), align 8
101 // CHECK-LABEL: define internal void @__cxx_global_var_init
102 // X86: call void @_ZN8witharg1C1ERK10destroyme1(ptr {{[^,]*}} @_ZGR15globalInitList2_
103 // X86: call void @_ZN8witharg1C1ERK10destroyme1(ptr {{[^,]*}} getelementptr inbounds (%[[WITHARG]], ptr @_ZGR15globalInitList2_, i{{32|64}} 1)
104 // AMDGCN: call void @_ZN8witharg1C1ERK10destroyme1(ptr {{[^,]*}} addrspacecast ({{[^@]+}} @_ZGR15globalInitList2_ {{[^)]+}}
105 // AMDGCN: call void @_ZN8witharg1C1ERK10destroyme1(ptr {{[^,]*}} getelementptr inbounds (%[[WITHARG]], ptr addrspacecast ({{[^@]+}} @_ZGR15globalInitList2_ {{[^)]+}}), i{{32|64}} 1
106 // CHECK: call i32 @__cxa_atexit
107 // X86: store ptr @_ZGR15globalInitList2_, ptr @globalInitList2, align 8
108 // X86: store i64 2, ptr getelementptr inbounds (%{{.*}}, ptr @globalInitList2, i32 0, i32 1), align 8
109 // AMDGCN: store ptr addrspacecast ({{[^@]+}} @_ZGR15globalInitList2_ {{[^)]+}}),
110 // AMDGCN: ptr addrspacecast ({{[^@]+}} @globalInitList2 {{[^)]+}}), align 8
111 // AMDGCN: store i64 2, ptr getelementptr inbounds (%{{.*}}, ptr addrspacecast ({{[^@]+}} @globalInitList2 {{[^)]+}}), i32 0, i32 1), align 8
112 // CHECK: call void @_ZN10destroyme1D1Ev
113 // CHECK-NEXT: call void @_ZN10destroyme1D1Ev
114 // CHECK-NEXT: ret void
115 std::initializer_list<witharg1> globalInitList2 = {
116 witharg1(destroyme1()), witharg1(destroyme1())
119 void fn1(int i) {
120 // CHECK-LABEL: define{{.*}} void @_Z3fn1i
121 // temporary array
122 // X86: [[array:%[^ ]+]] = alloca [3 x i32]
123 // AMDGCN: [[alloca:%[^ ]+]] = alloca [3 x i32], align 4, addrspace(5)
124 // AMDGCN: [[array:%[^ ]+]] ={{.*}} addrspacecast ptr addrspace(5) [[alloca]] to ptr
125 // CHECK: getelementptr inbounds [3 x i32], ptr [[array]], i{{32|64}} 0
126 // CHECK-NEXT: store i32 1, ptr
127 // CHECK-NEXT: getelementptr
128 // CHECK-NEXT: store
129 // CHECK-NEXT: getelementptr
130 // CHECK-NEXT: load
131 // CHECK-NEXT: store
132 // init the list
133 // CHECK-NEXT: getelementptr
134 // CHECK-NEXT: getelementptr inbounds [3 x i32], ptr
135 // CHECK-NEXT: store ptr
136 // CHECK-NEXT: getelementptr
137 // CHECK-NEXT: store i{{32|64}} 3
138 std::initializer_list<int> intlist{1, 2, i};
141 void fn2() {
142 // CHECK-LABEL: define{{.*}} void @_Z3fn2v
143 void target(std::initializer_list<destroyme1>);
144 // objects should be destroyed before dm2, after call returns
145 // CHECK: call void @_Z6targetSt16initializer_listI10destroyme1E
146 target({ destroyme1(), destroyme1() });
147 // CHECK: call void @_ZN10destroyme1D1Ev
148 destroyme2 dm2;
149 // CHECK: call void @_ZN10destroyme2D1Ev
152 void fn3() {
153 // CHECK-LABEL: define{{.*}} void @_Z3fn3v
154 // objects should be destroyed after dm2
155 auto list = { destroyme1(), destroyme1() };
156 destroyme2 dm2;
157 // CHECK: call void @_ZN10destroyme2D1Ev
158 // CHECK: call void @_ZN10destroyme1D1Ev
161 void fn4() {
162 // CHECK-LABEL: define{{.*}} void @_Z3fn4v
163 void target(std::initializer_list<witharg1>);
164 // objects should be destroyed before dm2, after call returns
165 // CHECK: call void @_ZN8witharg1C1ERK10destroyme1
166 // CHECK: call void @_Z6targetSt16initializer_listI8witharg1E
167 target({ witharg1(destroyme1()), witharg1(destroyme1()) });
168 // CHECK: call void @_ZN8witharg1D1Ev
169 // CHECK: call void @_ZN10destroyme1D1Ev
170 destroyme2 dm2;
171 // CHECK: call void @_ZN10destroyme2D1Ev
174 void fn5() {
175 // CHECK-LABEL: define{{.*}} void @_Z3fn5v
176 // temps should be destroyed before dm2
177 // objects should be destroyed after dm2
178 // CHECK: call void @_ZN8witharg1C1ERK10destroyme1
179 auto list = { witharg1(destroyme1()), witharg1(destroyme1()) };
180 // CHECK: call void @_ZN10destroyme1D1Ev
181 destroyme2 dm2;
182 // CHECK: call void @_ZN10destroyme2D1Ev
183 // CHECK: call void @_ZN8witharg1D1Ev
186 void fn6() {
187 // CHECK-LABEL: define{{.*}} void @_Z3fn6v
188 void target(const wantslist1&);
189 // objects should be destroyed before dm2, after call returns
190 // CHECK: call void @_ZN10wantslist1C1ESt16initializer_listI10destroyme1E
191 // CHECK: call void @_Z6targetRK10wantslist1
192 target({ destroyme1(), destroyme1() });
193 // CHECK: call void @_ZN10wantslist1D1Ev
194 // CHECK: call void @_ZN10destroyme1D1Ev
195 destroyme2 dm2;
196 // CHECK: call void @_ZN10destroyme2D1Ev
198 void fn7() {
199 // CHECK-LABEL: define{{.*}} void @_Z3fn7v
200 // temps should be destroyed before dm2
201 // object should be destroyed after dm2
202 // CHECK: call void @_ZN10wantslist1C1ESt16initializer_listI10destroyme1E
203 wantslist1 wl = { destroyme1(), destroyme1() };
204 // CHECK: call void @_ZN10destroyme1D1Ev
205 destroyme2 dm2;
206 // CHECK: call void @_ZN10destroyme2D1Ev
207 // CHECK: call void @_ZN10wantslist1D1Ev
210 void fn8() {
211 // CHECK-LABEL: define{{.*}} void @_Z3fn8v
212 void target(std::initializer_list<std::initializer_list<destroyme1>>);
213 // objects should be destroyed before dm2, after call returns
214 // CHECK: call void @_Z6targetSt16initializer_listIS_I10destroyme1EE
215 std::initializer_list<destroyme1> inner;
216 target({ inner, { destroyme1() } });
217 // CHECK: call void @_ZN10destroyme1D1Ev
218 // Only one destroy loop, since only one inner init list is directly inited.
219 // CHECK-NOT: call void @_ZN10destroyme1D1Ev
220 destroyme2 dm2;
221 // CHECK: call void @_ZN10destroyme2D1Ev
224 void fn9() {
225 // CHECK-LABEL: define{{.*}} void @_Z3fn9v
226 // objects should be destroyed after dm2
227 std::initializer_list<destroyme1> inner;
228 std::initializer_list<std::initializer_list<destroyme1>> list =
229 { inner, { destroyme1() } };
230 destroyme2 dm2;
231 // CHECK: call void @_ZN10destroyme2D1Ev
232 // CHECK: call void @_ZN10destroyme1D1Ev
233 // Only one destroy loop, since only one inner init list is directly inited.
234 // CHECK-NOT: call void @_ZN10destroyme1D1Ev
235 // CHECK: ret void
238 void fn10(int i) {
239 // CHECK-LABEL: define{{.*}} void @_Z4fn10i
240 // CHECK: alloca [3 x i32]
241 // CHECK-X86: call noalias nonnull align 16 ptr @_Znw{{[jm]}}
242 // CHECK-AMDGPU: call noalias nonnull align 8 ptr @_Znw{{[jm]}}
243 // CHECK: store i32 %
244 // CHECK: store i32 2
245 // CHECK: store i32 3
246 // CHECK: store ptr
247 (void) new std::initializer_list<int> {i, 2, 3};
250 void fn11() {
251 // CHECK-LABEL: define{{.*}} void @_Z4fn11v
252 (void) new std::initializer_list<destroyme1> {destroyme1(), destroyme1()};
253 // CHECK: call void @_ZN10destroyme1D1Ev
254 destroyme2 dm2;
255 // CHECK: call void @_ZN10destroyme2D1Ev
258 namespace PR12178 {
259 struct string {
260 string(int);
261 ~string();
264 struct pair {
265 string a;
266 int b;
269 struct map {
270 map(std::initializer_list<pair>);
273 map m{ {1, 2}, {3, 4} };
276 namespace rdar13325066 {
277 struct X { ~X(); };
279 // CHECK-LABEL: define{{.*}} void @_ZN12rdar133250664loopERNS_1XES1_
280 void loop(X &x1, X &x2) {
281 // CHECK: br label
282 // CHECK: br i1
283 // CHECK: br label
284 // CHECK: call void @_ZN12rdar133250661XD1Ev
285 // CHECK: br label
286 // CHECK: br label
287 // CHECK: call void @_ZN12rdar133250661XD1Ev
288 // CHECK: br i1
289 // CHECK: br label
290 // CHECK: ret void
291 for (X x : { x1, x2 }) { }
295 namespace dtors {
296 struct S {
297 S();
298 ~S();
300 void z();
302 // CHECK-LABEL: define{{.*}} void @_ZN5dtors1fEv(
303 void f() {
304 // CHECK: call void @_ZN5dtors1SC1Ev(
305 // CHECK: call void @_ZN5dtors1SC1Ev(
306 std::initializer_list<S>{ S(), S() };
308 // Destruction loop for underlying array.
309 // CHECK: br label
310 // CHECK: call void @_ZN5dtors1SD1Ev(
311 // CHECK: br i1
313 // CHECK: call void @_ZN5dtors1zEv(
314 z();
316 // CHECK-NOT: call void @_ZN5dtors1SD1Ev(
319 // CHECK-LABEL: define{{.*}} void @_ZN5dtors1gEv(
320 void g() {
321 // CHECK: call void @_ZN5dtors1SC1Ev(
322 // CHECK: call void @_ZN5dtors1SC1Ev(
323 auto x = std::initializer_list<S>{ S(), S() };
325 // Destruction loop for underlying array.
326 // CHECK: br label
327 // CHECK: call void @_ZN5dtors1SD1Ev(
328 // CHECK: br i1
330 // CHECK: call void @_ZN5dtors1zEv(
331 z();
333 // CHECK-NOT: call void @_ZN5dtors1SD1Ev(
336 // CHECK-LABEL: define{{.*}} void @_ZN5dtors1hEv(
337 void h() {
338 // CHECK: call void @_ZN5dtors1SC1Ev(
339 // CHECK: call void @_ZN5dtors1SC1Ev(
340 std::initializer_list<S> x = { S(), S() };
342 // CHECK-NOT: call void @_ZN5dtors1SD1Ev(
344 // CHECK: call void @_ZN5dtors1zEv(
345 z();
347 // Destruction loop for underlying array.
348 // CHECK: br label
349 // CHECK: call void @_ZN5dtors1SD1Ev(
350 // CHECK: br i1
354 namespace partly_constant {
355 int k;
356 std::initializer_list<std::initializer_list<int>> &&il = { { 1, 2, 3 }, { 4, k }, { 5, 6, 7, 8 } };
357 // First init list.
358 // CHECK-NOT: @[[PARTLY_CONSTANT_FIRST]],
359 // CHECK: store ptr {{.*}}@[[PARTLY_CONSTANT_FIRST]]{{.*}}, ptr {{.*}}@[[PARTLY_CONSTANT_INNER]]{{.*}}
360 // CHECK: store i64 3, ptr getelementptr inbounds ({{.*}}, ptr {{.*}}@[[PARTLY_CONSTANT_INNER]]{{.*}}, i32 0, i32 1)
361 // CHECK-NOT: @[[PARTLY_CONSTANT_FIRST]],
363 // Second init list array (non-constant).
364 // CHECK: store i32 4, ptr {{.*}}@[[PARTLY_CONSTANT_SECOND]]{{.*}}
365 // CHECK: load i32, ptr {{.*}}@_ZN15partly_constant1kE
366 // CHECK: store i32 {{.*}}, ptr getelementptr inbounds ({{.*}}, ptr {{.*}}@[[PARTLY_CONSTANT_SECOND]]{{.*}}, i64 1)
368 // Second init list.
369 // CHECK: store ptr {{.*}}@[[PARTLY_CONSTANT_SECOND]]{{.*}}, ptr getelementptr inbounds ({{.*}}, ptr {{.*}}@[[PARTLY_CONSTANT_INNER]]{{.*}}, i64 1)
370 // CHECK: store i64 2, ptr getelementptr inbounds ({{.*}}, ptr {{.*}}@[[PARTLY_CONSTANT_INNER]]{{.*}}, i64 1, i32 1)
372 // Third init list.
373 // CHECK-NOT: @[[PARTLY_CONSTANT_THIRD]],
374 // CHECK: store ptr {{.*}}@[[PARTLY_CONSTANT_THIRD]]{{.*}}, ptr getelementptr inbounds ({{.*}}, ptr {{.*}}@[[PARTLY_CONSTANT_INNER]]{{.*}}, i64 2)
375 // CHECK: store i64 4, ptr getelementptr inbounds ({{.*}}, ptr {{.*}}@[[PARTLY_CONSTANT_INNER]]{{.*}}, i64 2, i32 1)
376 // CHECK-NOT: @[[PARTLY_CONSTANT_THIRD]],
378 // Outer init list.
379 // CHECK: store ptr {{.*}}@[[PARTLY_CONSTANT_INNER]]{{.*}}, ptr {{.*}}@[[PARTLY_CONSTANT_OUTER]]{{.*}}
380 // CHECK: store i64 3, ptr getelementptr inbounds ({{.*}}, ptr {{.*}}@[[PARTLY_CONSTANT_OUTER]]{{.*}}, i32 0, i32 1)
382 // 'il' reference.
383 // CHECK: store ptr {{.*}}@[[PARTLY_CONSTANT_OUTER]]{{.*}}, ptr {{.*}}@_ZN15partly_constant2ilE{{.*}}, align 8
385 namespace nested {
386 struct A { A(); ~A(); };
387 struct B { const A &a; ~B(); };
388 struct C { std::initializer_list<B> b; ~C(); };
389 void f();
390 // CHECK-LABEL: define{{.*}} void @_ZN6nested1gEv(
391 void g() {
392 // CHECK: call void @_ZN6nested1AC1Ev(
393 // CHECK-NOT: call
394 // CHECK: call void @_ZN6nested1AC1Ev(
395 // CHECK-NOT: call
396 const C &c { { { A() }, { A() } } };
398 // CHECK: call void @_ZN6nested1fEv(
399 // CHECK-NOT: call
400 f();
402 // CHECK: call void @_ZN6nested1CD1Ev(
403 // CHECK-NOT: call
405 // Destroy B[2] array.
406 // FIXME: This isn't technically correct: reverse construction order would
407 // destroy the second B then the second A then the first B then the first A.
408 // CHECK: call void @_ZN6nested1BD1Ev(
409 // CHECK-NOT: call
410 // CHECK: br
412 // CHECK-NOT: call
413 // CHECK: call void @_ZN6nested1AD1Ev(
414 // CHECK-NOT: call
415 // CHECK: call void @_ZN6nested1AD1Ev(
416 // CHECK-NOT: call
417 // CHECK: }
421 namespace DR1070 {
422 struct A {
423 A(std::initializer_list<int>);
425 struct B {
426 int i;
427 A a;
429 B b = {1};
430 struct C {
431 std::initializer_list<int> a;
432 B b;
433 std::initializer_list<double> c;
435 C c = {};
438 namespace ArrayOfInitList {
439 struct S {
440 S(std::initializer_list<int>);
442 S x[1] = {};
445 namespace PR20445 {
446 struct vector { vector(std::initializer_list<int>); };
447 struct MyClass { explicit MyClass(const vector &v); };
448 template<int x> void f() { new MyClass({42, 43}); }
449 template void f<0>();
450 // CHECK-LABEL: define {{.*}} @_ZN7PR204451fILi0EEEvv(
451 // CHECK: store ptr {{.*}}@[[REFTMP1]]{{.*}}
452 // CHECK: call void @_ZN7PR204456vectorC1ESt16initializer_listIiE(
453 // CHECK: call void @_ZN7PR204457MyClassC1ERKNS_6vectorE(
456 namespace ConstExpr {
457 class C {
458 int x;
459 public:
460 constexpr C(int x) : x(x) {}
462 void f(std::initializer_list<C>);
463 void g() {
464 // CHECK-LABEL: _ZN9ConstExpr1gEv
465 // CHECK: store ptr {{.*}}@[[REFTMP2]]{{.*}}
466 // CHECK: call void @_ZN9ConstExpr1fESt16initializer_listINS_1CEE
467 f({C(1), C(2), C(3)});
471 namespace B19773010 {
472 template <class T1, class T2> struct pair {
473 T1 first;
474 T2 second;
475 constexpr pair() : first(), second() {}
476 constexpr pair(T1 a, T2 b) : first(a), second(b) {}
479 enum E { ENUM_CONSTANT };
480 struct testcase {
481 testcase(std::initializer_list<pair<const char *, E>>);
483 void f1() {
484 // CHECK-LABEL: @_ZN9B197730102f1Ev
485 testcase a{{"", ENUM_CONSTANT}};
486 // X86: store ptr @.ref.tmp{{.*}}, ptr %{{.*}}, align 8
487 // AMDGCN: store ptr addrspacecast{{.*}} @.ref.tmp{{.*}}{{.*}}, ptr %{{.*}}, align 8
489 void f2() {
490 // CHECK-LABEL: @_ZN9B197730102f2Ev
491 // X86: store ptr @_ZGRZN9B197730102f2EvE1p_, ptr getelementptr inbounds (%"class.std::initializer_list.10", ptr @_ZZN9B197730102f2EvE1p, i64 1), align 16
492 // AMDGCN: store ptr addrspacecast{{.*}} @_ZGRZN9B197730102f2EvE1p_{{.*}}, ptr getelementptr inbounds (%"class.std::initializer_list.10", ptr addrspacecast{{.*}}@_ZZN9B197730102f2EvE1p{{.*}}, i64 1), align 8
493 static std::initializer_list<pair<const char *, E>> a, p[2] =
494 {a, {{"", ENUM_CONSTANT}}};
497 void PR22940_helper(const pair<void*, int>&) { }
498 void PR22940() {
499 // CHECK-LABEL: @_ZN9B197730107PR22940Ev
500 // CHECK: call {{.*}} @_ZN9B197730104pairIPviEC{{.}}Ev(
501 // CHECK: call {{.*}} @_ZN9B1977301014PR22940_helperERKNS_4pairIPviEE(
502 PR22940_helper(pair<void*, int>());