1 // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck --check-prefixes=CHECK,LINUX,LINUX_AIX %s
2 // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -O2 -disable-llvm-passes -o - -triple x86_64-linux-gnu | FileCheck --check-prefixes=CHECK,LINUX,LINUX_AIX,CHECK-OPT %s
3 // RUN: %clang_cc1 -std=c++11 -femulated-tls -emit-llvm %s -o - \
4 // RUN: -triple x86_64-linux-gnu 2>&1 | FileCheck --check-prefixes=CHECK,LINUX,LINUX_AIX %s
5 // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple x86_64-apple-darwin12 | FileCheck --check-prefix=CHECK --check-prefix=DARWIN %s
6 // RUN: %clang_cc1 -std=c++11 -emit-llvm %s -o - -triple powerpc64-unknown-aix-xcoff | FileCheck --check-prefixes=CHECK,AIX,LINUX_AIX %s
8 // RUN: %clang_cc1 -std=c++11 -fno-use-cxa-atexit -emit-llvm %s -o - -triple x86_64-linux-gnu | FileCheck --check-prefixes=CHECK,LINUX,LINUX_AIX %s
9 // RUN: %clang_cc1 -std=c++11 -fno-use-cxa-atexit -emit-llvm %s -O2 -disable-llvm-passes -o - -triple x86_64-linux-gnu | FileCheck --check-prefixes=CHECK,LINUX,LINUX_AIX,CHECK-OPT %s
10 // RUN: %clang_cc1 -std=c++11 -fno-use-cxa-atexit -femulated-tls -emit-llvm %s -o - \
11 // RUN: -triple x86_64-linux-gnu 2>&1 | FileCheck --check-prefixes=CHECK,LINUX,LINUX_AIX %s
12 // RUN: %clang_cc1 -std=c++11 -fno-use-cxa-atexit -emit-llvm %s -o - -triple x86_64-apple-darwin12 | FileCheck --check-prefix=CHECK --check-prefix=DARWIN %s
17 // LINUX_AIX-DAG: @a ={{.*}} thread_local global i32 0
18 // DARWIN-DAG: @a = internal thread_local global i32 0
19 thread_local
int a
= f();
20 extern thread_local
int b
;
21 // CHECK-DAG: @c ={{.*}} global i32 0
23 // CHECK-DAG: @_ZL1d = internal thread_local global i32 0
24 static thread_local
int d
= g();
26 struct U
{ static thread_local
int m
; };
27 // LINUX_AIX-DAG: @_ZN1U1mE ={{.*}} thread_local global i32 0
28 // DARWIN-DAG: @_ZN1U1mE = internal thread_local global i32 0
29 thread_local
int U::m
= f();
31 namespace MismatchedInitType
{
32 // Check that we don't crash here when we're forced to create a new global
33 // variable (with a different type) when we add the initializer.
37 constexpr U() : f(0.0) {}
39 static thread_local U u
;
43 template<typename T
> struct V
{ static thread_local
int m
; };
44 template<typename T
> thread_local
int V
<T
>::m
= g();
46 template<typename T
> struct W
{ static thread_local
int m
; };
47 template<typename T
> thread_local
int W
<T
>::m
= 123;
49 struct Dtor
{ ~Dtor(); };
50 template<typename T
> struct X
{ static thread_local Dtor m
; };
51 template<typename T
> thread_local Dtor X
<T
>::m
;
53 // CHECK-DAG: @e ={{.*}} global
54 void *e
= V
<int>::m
+ W
<int>::m
+ &X
<int>::m
;
56 template thread_local
int V
<float>::m
;
57 template thread_local
int W
<float>::m
;
58 template thread_local Dtor X
<float>::m
;
60 extern template thread_local
int V
<char>::m
;
61 extern template thread_local
int W
<char>::m
;
62 extern template thread_local Dtor X
<char>::m
;
64 void *e2
= V
<char>::m
+ W
<char>::m
+ &X
<char>::m
;
66 // CHECK-DAG: @_ZN1VIiE1mE = linkonce_odr thread_local global i32 0
67 // CHECK-DAG: @_ZN1WIiE1mE = linkonce_odr thread_local global i32 123
68 // CHECK-DAG: @_ZN1XIiE1mE = linkonce_odr thread_local global {{.*}}
69 // CHECK-DAG: @_ZN1VIfE1mE = weak_odr thread_local global i32 0
70 // CHECK-DAG: @_ZN1WIfE1mE = weak_odr thread_local global i32 123
71 // CHECK-DAG: @_ZN1XIfE1mE = weak_odr thread_local global {{.*}}
73 // CHECK-DAG: @_ZZ1fvE1n = internal thread_local global i32 0
75 // CHECK-DAG: @_ZGVZ1fvE1n = internal thread_local global i8 0
77 // CHECK-DAG: @_ZZ8tls_dtorvE1s = internal thread_local global
78 // CHECK-DAG: @_ZGVZ8tls_dtorvE1s = internal thread_local global i8 0
80 // CHECK-DAG: @_ZZ8tls_dtorvE1t = internal thread_local global
81 // CHECK-DAG: @_ZGVZ8tls_dtorvE1t = internal thread_local global i8 0
83 // CHECK-DAG: @_ZZ8tls_dtorvE1u = internal thread_local global
84 // CHECK-DAG: @_ZGVZ8tls_dtorvE1u = internal thread_local global i8 0
85 // CHECK-DAG: @_ZGRZ8tls_dtorvE1u_ = internal thread_local global
87 // CHECK-DAG: @_ZGVN1VIiE1mE = linkonce_odr thread_local global i64 0
89 // CHECK-DAG: @__tls_guard = internal thread_local global i8 0
91 // CHECK-DAG: @llvm.global_ctors = appending global {{.*}} @[[GLOBAL_INIT:[^ ]*]]
93 // LINUX_AIX-DAG: @_ZTH1a ={{.*}} alias void (), ptr @__tls_init
94 // DARWIN-DAG: @_ZTH1a = internal alias void (), ptr @__tls_init
95 // LINUX_AIX-DAG: @_ZTHN1U1mE ={{.*}} alias void (), ptr @__tls_init
96 // DARWIN-DAG: @_ZTHN1U1mE = internal alias void (), ptr @__tls_init
97 // CHECK-DAG: @_ZTHN1VIiE1mE = linkonce_odr alias void (), ptr @[[V_M_INIT:[^, ]*]]
98 // CHECK-DAG: @_ZTHN1XIiE1mE = linkonce_odr alias void (), ptr @[[X_M_INIT:[^, ]*]]
99 // CHECK-DAG: @_ZTHN1VIfE1mE = weak_odr alias void (), ptr @[[VF_M_INIT:[^, ]*]]
100 // CHECK-DAG: @_ZTHN1XIfE1mE = weak_odr alias void (), ptr @[[XF_M_INIT:[^, ]*]]
101 // FIXME: We really want a CHECK-DAG-NOT for these.
102 // CHECK-NOT: @_ZTHN1WIiE1mE =
103 // CHECK-NOT: @_ZTHN1WIfE1mE =
104 // CHECK-NOT: @_ZTHL1d =
107 // Individual variable initialization functions:
109 // CHECK: define {{.*}} @[[A_INIT:.*]]()
110 // CHECK: call{{.*}} i32 @_Z1fv()
111 // CHECK: [[A_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @a)
112 // CHECK-NEXT: store i32 {{.*}}, ptr [[A_ADDR]], align 4
114 // CHECK-LABEL: define{{.*}} i32 @_Z1fv()
116 // CHECK: %[[GUARD:.*]] = load i8, ptr @_ZGVZ1fvE1n, align 1
117 // CHECK: %[[NEED_INIT:.*]] = icmp eq i8 %[[GUARD]], 0
118 // CHECK: br i1 %[[NEED_INIT]]{{.*}}
120 // CHECK: %[[CALL:.*]] = call{{.*}} i32 @_Z1gv()
121 // CHECK: [[N_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZZ1fvE1n)
122 // CHECK: store i32 %[[CALL]], ptr [[N_ADDR]], align 4
123 // CHECK: store i8 1, ptr @_ZGVZ1fvE1n
125 static thread_local
int n
= g();
127 // CHECK: [[N_ADDR2:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZZ1fvE1n)
128 // CHECK: load i32, ptr [[N_ADDR2]], align 4
132 // CHECK: define {{.*}} @[[C_INIT:.*]]()
133 // LINUX_AIX: call ptr @_ZTW1b()
134 // DARWIN: call cxx_fast_tlscc ptr @_ZTW1b()
135 // CHECK-NEXT: load i32, ptr %{{.*}}, align 4
136 // CHECK-NEXT: store i32 %{{.*}}, ptr @c, align 4
138 // LINUX_AIX-LABEL: define linkonce_odr hidden noundef ptr @_ZTW1b()
139 // LINUX: [[CMP:%.*]] = icmp ne ptr @_ZTH1b, null
140 // LINUX: br i1 [[CMP]]
141 // AIX-NOT: [[CMP:%.*]] = icmp ne ptr @_ZTH1b, null
143 // LINUX_AIX: call void @_ZTH1b()
147 // LINUX_AIX: [[B_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @b)
148 // LINUX_AIX: ret ptr [[B_ADDR]]
149 // DARWIN-LABEL: declare cxx_fast_tlscc noundef ptr @_ZTW1b()
150 // There is no definition of the thread wrapper on Darwin for external TLV.
152 // CHECK: define {{.*}} @[[D_INIT:.*]]()
153 // CHECK: call{{.*}} i32 @_Z1gv()
154 // CHECK-NEXT: [[D_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZL1d)
155 // CHECK-NEXT: store i32 %{{.*}}, ptr [[D_ADDR]], align 4
157 // CHECK: define {{.*}} @[[U_M_INIT:.*]]()
158 // CHECK: call{{.*}} i32 @_Z1fv()
159 // CHECK-NEXT: [[UM_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZN1U1mE)
160 // CHECK-NEXT: store i32 %{{.*}}, ptr [[UM_ADDR]], align 4
162 // CHECK: define {{.*}} @[[E_INIT:.*]]()
163 // LINUX_AIX: call ptr @_ZTWN1VIiE1mE()
164 // DARWIN: call cxx_fast_tlscc ptr @_ZTWN1VIiE1mE()
165 // CHECK-NEXT: load i32, ptr %{{.*}}, align 4
166 // LINUX_AIX: call ptr @_ZTWN1XIiE1mE()
167 // DARWIN: call cxx_fast_tlscc ptr @_ZTWN1XIiE1mE()
168 // CHECK: store {{.*}} @e
170 // LINUX_AIX-LABEL: define weak_odr hidden noundef ptr @_ZTWN1VIiE1mE()
171 // DARWIN-LABEL: define weak_odr hidden cxx_fast_tlscc noundef ptr @_ZTWN1VIiE1mE()
172 // LINUX_AIX: call void @_ZTHN1VIiE1mE()
173 // DARWIN: call cxx_fast_tlscc void @_ZTHN1VIiE1mE()
174 // CHECK: [[VM_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZN1VIiE1mE)
175 // CHECK: ret ptr [[VM_ADDR]]
177 // LINUX_AIX-LABEL: define weak_odr hidden noundef ptr @_ZTWN1WIiE1mE()
178 // DARWIN-LABEL: define weak_odr hidden cxx_fast_tlscc noundef ptr @_ZTWN1WIiE1mE()
180 // CHECK: [[WM_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZN1WIiE1mE)
181 // CHECK: ret ptr [[WM_ADDR]]
183 // LINUX_AIX-LABEL: define weak_odr hidden {{.*}}ptr @_ZTWN1XIiE1mE()
184 // DARWIN-LABEL: define weak_odr hidden cxx_fast_tlscc {{.*}}ptr @_ZTWN1XIiE1mE()
185 // LINUX_AIX: call void @_ZTHN1XIiE1mE()
186 // DARWIN: call cxx_fast_tlscc void @_ZTHN1XIiE1mE()
187 // CHECK: [[XM_ADDR:%.+]] = call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @_ZN1XIiE1mE)
188 // CHECK: ret ptr [[XM_ADDR]]
190 // LINUX_AIX: define internal void @[[VF_M_INIT]]()
191 // DARWIN: define internal cxx_fast_tlscc void @[[VF_M_INIT]]()
193 // CHECK: load i8, ptr @_ZGVN1VIfE1mE
194 // CHECK: %[[VF_M_INITIALIZED:.*]] = icmp eq i8 %{{.*}}, 0
195 // CHECK: br i1 %[[VF_M_INITIALIZED]],
197 // CHECK: store i8 1, ptr @_ZGVN1VIfE1mE
198 // CHECK: call{{.*}} i32 @_Z1gv()
199 // CHECK: [[VFM_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZN1VIfE1mE)
200 // CHECK: store i32 %{{.*}}, ptr [[VFM_ADDR]], align 4
203 // LINUX_AIX: define internal void @[[XF_M_INIT]]()
204 // DARWIN: define internal cxx_fast_tlscc void @[[XF_M_INIT]]()
206 // CHECK: load i8, ptr @_ZGVN1XIfE1mE
207 // CHECK: %[[XF_M_INITIALIZED:.*]] = icmp eq i8 %{{.*}}, 0
208 // CHECK: br i1 %[[XF_M_INITIALIZED]],
210 // CHECK: store i8 1, ptr @_ZGVN1XIfE1mE
212 // LINUX: call {{.*}}__cxa_thread_atexit
213 // AIX: call {{.*}}__pt_atexit_np
214 // DARWIN: call {{.*}}_tlv_atexit
217 // LINUX: declare i32 @__cxa_thread_atexit(ptr, ptr, ptr)
218 // AIX: declare i32 @__pt_atexit_np(i32, ptr, ...)
219 // DARWIN: declare i32 @_tlv_atexit(ptr, ptr, ptr)
221 // DARWIN: declare cxx_fast_tlscc noundef ptr @_ZTWN1VIcE1mE()
222 // LINUX_AIX: define linkonce_odr hidden noundef ptr @_ZTWN1VIcE1mE() {{#[0-9]+}}{{( comdat)?}} {
223 // LINUX: [[CMP:%.*]] = icmp ne ptr @_ZTHN1VIcE1mE,
224 // LINUX: br i1 [[CMP]]
225 // AIX-NOT: [[CMP:%.*]] = icmp ne ptr @_ZTHN1VIcE1mE,
226 // LINUX_AIX: call void @_ZTHN1VIcE1mE()
227 // LINUX_AIX: [[VEM_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZN1VIcE1mE)
228 // LINUX_AIX: ret ptr [[VEM_ADDR]]
230 // DARWIN: declare cxx_fast_tlscc noundef ptr @_ZTWN1WIcE1mE()
231 // LINUX_AIX: define linkonce_odr hidden noundef ptr @_ZTWN1WIcE1mE() {{#[0-9]+}}{{( comdat)?}} {
232 // LINUX: [[CMP:%.*]] = icmp ne ptr @_ZTHN1WIcE1mE,
233 // LINUX: br i1 [[CMP]]
234 // AIX-NOT: [[CMP:%.*]] = icmp ne ptr @_ZTHN1WIcE1mE,
235 // LINUX_AIX: call void @_ZTHN1WIcE1mE()
236 // LINUX_AIX: [[WEM_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZN1WIcE1mE)
237 // LINUX_AIX: ret ptr [[WEM_ADDR]]
239 // DARWIN: declare cxx_fast_tlscc {{.*}}ptr @_ZTWN1XIcE1mE()
240 // LINUX_AIX: define linkonce_odr hidden {{.*}}ptr @_ZTWN1XIcE1mE() {{#[0-9]+}}{{( comdat)?}} {
241 // LINUX: [[CMP:%.*]] = icmp ne ptr @_ZTHN1XIcE1mE,
242 // LINUX: br i1 [[CMP]]
243 // AIX-NOT: [[CMP:%.*]] = icmp ne ptr @_ZTHN1XIcE1mE,
244 // LINUX_AIX: call void @_ZTHN1XIcE1mE()
245 // LINUX_AIX: [[XEM_ADDR:%.+]] = call align 1 ptr @llvm.threadlocal.address.p0(ptr align 1 @_ZN1XIcE1mE)
246 // LINUX_AIX: ret ptr [[XEM_ADDR]]
248 struct S
{ S(); ~S(); };
251 // CHECK-LABEL: define{{.*}} void @_Z8tls_dtorv()
253 // CHECK: load i8, ptr @_ZGVZ8tls_dtorvE1s
254 // CHECK: call void @_ZN1SC1Ev(ptr {{[^,]*}} @_ZZ8tls_dtorvE1s)
255 // LINUX: call i32 @__cxa_thread_atexit({{.*}}@_ZN1SD1Ev, {{.*}} @_ZZ8tls_dtorvE1s{{.*}} @__dso_handle
256 // AIX: call i32 (i32, ptr, ...) @__pt_atexit_np(i32 0, {{.*}}@__dtor__ZZ8tls_dtorvE1s){{.*}}
257 // DARWIN: call i32 @_tlv_atexit({{.*}}@_ZN1SD1Ev, {{.*}} @_ZZ8tls_dtorvE1s{{.*}} @__dso_handle
258 // CHECK: store i8 1, ptr @_ZGVZ8tls_dtorvE1s
259 static thread_local S s
;
261 // CHECK: load i8, ptr @_ZGVZ8tls_dtorvE1t
263 // LINUX: call i32 @__cxa_thread_atexit({{.*}}@_ZN1TD1Ev, {{.*}}@_ZZ8tls_dtorvE1t{{.*}} @__dso_handle
264 // AIX: call i32 (i32, ptr, ...) @__pt_atexit_np(i32 0, {{.*}}@__dtor__ZZ8tls_dtorvE1t){{.*}}
265 // DARWIN: call i32 @_tlv_atexit({{.*}}@_ZN1TD1Ev, {{.*}}@_ZZ8tls_dtorvE1t{{.*}} @__dso_handle
266 // CHECK: store i8 1, ptr @_ZGVZ8tls_dtorvE1t
267 static thread_local T t
;
269 // CHECK: load i8, ptr @_ZGVZ8tls_dtorvE1u
270 // CHECK: call void @_ZN1SC1Ev(ptr {{[^,]*}} @_ZGRZ8tls_dtorvE1u_)
271 // LINUX: call i32 @__cxa_thread_atexit({{.*}}@_ZN1SD1Ev, {{.*}} @_ZGRZ8tls_dtorvE1u_{{.*}} @__dso_handle
272 // AIX: call i32 (i32, ptr, ...) @__pt_atexit_np(i32 0, {{.*}}__dtor__ZZ8tls_dtorvE1u){{.*}}
273 // DARWIN: call i32 @_tlv_atexit({{.*}}@_ZN1SD1Ev, {{.*}} @_ZGRZ8tls_dtorvE1u_{{.*}} @__dso_handle
274 // CHECK: store i8 1, ptr @_ZGVZ8tls_dtorvE1u
275 static thread_local
const S
&u
= S();
278 // AIX: define {{.*}}@__dtor__ZZ8tls_dtorvE1s(i32 noundef signext %0, ...){{.*}}{
280 // AIX: %.addr = alloca i32, align 4
281 // AIX: store i32 %0, ptr %.addr, align 4
282 // AIX: call void @_ZN1SD1Ev(ptr @_ZZ8tls_dtorvE1s)
286 // AIX: define {{.*}}@__dtor__ZZ8tls_dtorvE1t(i32 noundef signext %0, ...){{.*}}{
288 // AIX: %.addr = alloca i32, align 4
289 // AIX: store i32 %0, ptr %.addr, align 4
290 // AIX: call void @_ZN1TD1Ev(ptr @_ZZ8tls_dtorvE1t)
294 // AIX: define {{.*}}@__dtor__ZZ8tls_dtorvE1u(i32 noundef signext %0, ...){{.*}}{
296 // AIX: %.addr = alloca i32, align 4
297 // AIX: store i32 %0, ptr %.addr, align 4
298 // AIX: call void @_ZN1SD1Ev(ptr @_ZGRZ8tls_dtorvE1u_)
302 // CHECK: define {{.*}} @_Z7PR15991v(
305 auto l
= [] { return n
; };
310 static thread_local
int n
;
313 // CHECK: define {{.*}} @_ZN7PR192541fEv(
315 // LINUX_AIX: call void @_ZTHN7PR192541nE(
316 // DARWIN: call cxx_fast_tlscc ptr @_ZTWN7PR192541nE(
321 thread_local
int anon_i
{f()};
326 // LINUX_AIX-LABEL: define internal noundef ptr @_ZTWN12_GLOBAL__N_16anon_iE()
327 // DARWIN-LABEL: define internal cxx_fast_tlscc noundef ptr @_ZTWN12_GLOBAL__N_16anon_iE()
329 // LINUX_AIX: define internal void @[[V_M_INIT]]()
330 // DARWIN: define internal cxx_fast_tlscc void @[[V_M_INIT]]()
332 // CHECK: load i8, ptr @_ZGVN1VIiE1mE
333 // CHECK: %[[V_M_INITIALIZED:.*]] = icmp eq i8 %{{.*}}, 0
334 // CHECK: br i1 %[[V_M_INITIALIZED]],
336 // CHECK: store i8 1, ptr @_ZGVN1VIiE1mE
337 // CHECK: call{{.*}} i32 @_Z1gv()
338 // CHECK: [[VEM_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZN1VIiE1mE)
339 // CHECK: store i32 %{{.*}}, ptr [[VEM_ADDR]], align 4
342 // LINUX_AIX: define internal void @[[X_M_INIT]]()
343 // DARWIN: define internal cxx_fast_tlscc void @[[X_M_INIT]]()
345 // CHECK: load i8, ptr @_ZGVN1XIiE1mE
346 // CHECK: %[[X_M_INITIALIZED:.*]] = icmp eq i8 %{{.*}}, 0
347 // CHECK: br i1 %[[X_M_INITIALIZED]],
349 // CHECK: store i8 1, ptr @_ZGVN1XIiE1mE
350 // LINUX: call {{.*}}__cxa_thread_atexit
351 // AIX: call {{.*}}__pt_atexit_np
352 // DARWIN: call {{.*}}_tlv_atexit
355 // CHECK: define {{.*}}@[[GLOBAL_INIT:.*]]()
356 // CHECK: call void @[[C_INIT]]()
357 // CHECK: call void @[[E_INIT]]()
360 // CHECK: define {{.*}}@__tls_init()
361 // CHECK: load i8, ptr @__tls_guard
362 // CHECK: %[[NEED_TLS_INIT:.*]] = icmp eq i8 %{{.*}}, 0
363 // CHECK: br i1 %[[NEED_TLS_INIT]],
365 // CHECK: store i8 1, ptr @__tls_guard
366 // CHECK-OPT: call ptr @llvm.invariant.start.p0(i64 1, ptr @__tls_guard)
367 // CHECK-NOT: call void @[[V_M_INIT]]()
368 // CHECK: call void @[[A_INIT]]()
369 // CHECK-NOT: call void @[[V_M_INIT]]()
370 // CHECK: call void @[[D_INIT]]()
371 // CHECK-NOT: call void @[[V_M_INIT]]()
372 // CHECK: call void @[[U_M_INIT]]()
373 // CHECK-NOT: call void @[[V_M_INIT]]()
376 // LINUX_AIX: define weak_odr hidden noundef ptr @_ZTW1a()
377 // DARWIN: define cxx_fast_tlscc noundef ptr @_ZTW1a()
378 // LINUX_AIX: call void @_ZTH1a()
379 // DARWIN: call cxx_fast_tlscc void @_ZTH1a()
380 // CHECK: [[A_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @a)
381 // CHECK: ret ptr [[A_ADDR]]
385 // Should not emit a thread wrapper for internal-linkage unused variable 'd'.
386 // We separately check that 'd' does in fact get initialized with the other
387 // thread-local variables in this TU.
388 // CHECK-NOT: define {{.*}} @_ZTWL1d()
390 // LINUX_AIX-LABEL: define weak_odr hidden noundef ptr @_ZTWN1U1mE()
391 // DARWIN-LABEL: define cxx_fast_tlscc noundef ptr @_ZTWN1U1mE()
392 // LINUX_AIX: call void @_ZTHN1U1mE()
393 // DARWIN: call cxx_fast_tlscc void @_ZTHN1U1mE()
394 // CHECK: [[UM_ADDR:%.+]] = call align 4 ptr @llvm.threadlocal.address.p0(ptr align 4 @_ZN1U1mE)
395 // CHECK: ret ptr [[UM_ADDR]]
397 // LINUX_AIX: declare extern_weak void @_ZTH1b() [[ATTR:#[0-9]+]]
399 // AIX: define linkonce_odr void @_ZTHN1WIiE1mE(){{.*}} {
400 // AIX-NEXT: ret void
402 // CHECK-NOT: @_ZTHN1WIfE1mE =
403 // AIX: define weak_odr void @_ZTHN1WIfE1mE(){{.*}} {
404 // AIX-NEXT: ret void
407 // LINUX_AIX: attributes [[ATTR]] = { {{.+}} }