1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -DBODY -triple x86_64-unknown-unknown -x c++ -emit-llvm %s -fexceptions -fcxx-exceptions -o - | FileCheck %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -emit-pch -o %t %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -DBODY -x c++ -triple x86_64-unknown-unknown -fexceptions -fcxx-exceptions -g -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix=CHECK-DEBUG %s
4*0a6a1f1dSLionel Sambuc // expected-no-diagnostics
5*0a6a1f1dSLionel Sambuc #ifndef HEADER
6*0a6a1f1dSLionel Sambuc #define HEADER
7*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[IDENT:%.+]] = type { i32, i32, i32, i32, i8* }
8*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[S1:%.+]] = type { [[INT:i[0-9]+]] }
9*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[S2:%.+]] = type { [[INT]], double }
10*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[S3:%.+]] = type { [[INT]], float }
11*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[S4:%.+]] = type { [[INT]], [[INT]] }
12*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[S5:%.+]] = type { [[INT]], [[INT]], [[INT]] }
13*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[SMAIN:%.+]] = type { [[INT]], double, double }
14*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[IDENT:%.+]] = type { i32, i32, i32, i32, i8* }
15*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[S1:%.+]] = type { [[INT:i[0-9]+]] }
16*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[S2:%.+]] = type { [[INT]], double }
17*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[S3:%.+]] = type { [[INT]], float }
18*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[S4:%.+]] = type { [[INT]], [[INT]] }
19*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[S5:%.+]] = type { [[INT]], [[INT]], [[INT]] }
20*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[SMAIN:%.+]] = type { [[INT]], double, double }
21*0a6a1f1dSLionel Sambuc
22*0a6a1f1dSLionel Sambuc struct S1 {
23*0a6a1f1dSLionel Sambuc int a;
S1S124*0a6a1f1dSLionel Sambuc S1()
25*0a6a1f1dSLionel Sambuc : a(0) {
26*0a6a1f1dSLionel Sambuc }
S1S127*0a6a1f1dSLionel Sambuc S1(int a)
28*0a6a1f1dSLionel Sambuc : a(a) {
29*0a6a1f1dSLionel Sambuc }
S1S130*0a6a1f1dSLionel Sambuc S1(const S1 &s) {
31*0a6a1f1dSLionel Sambuc a = 12 + s.a;
32*0a6a1f1dSLionel Sambuc }
~S1S133*0a6a1f1dSLionel Sambuc ~S1() {
34*0a6a1f1dSLionel Sambuc a = 0;
35*0a6a1f1dSLionel Sambuc }
36*0a6a1f1dSLionel Sambuc };
37*0a6a1f1dSLionel Sambuc
38*0a6a1f1dSLionel Sambuc struct S2 {
39*0a6a1f1dSLionel Sambuc int a;
40*0a6a1f1dSLionel Sambuc double b;
S2S241*0a6a1f1dSLionel Sambuc S2()
42*0a6a1f1dSLionel Sambuc : a(0) {
43*0a6a1f1dSLionel Sambuc }
S2S244*0a6a1f1dSLionel Sambuc S2(int a)
45*0a6a1f1dSLionel Sambuc : a(a) {
46*0a6a1f1dSLionel Sambuc }
S2S247*0a6a1f1dSLionel Sambuc S2(const S2 &s) {
48*0a6a1f1dSLionel Sambuc a = 12 + s.a;
49*0a6a1f1dSLionel Sambuc }
~S2S250*0a6a1f1dSLionel Sambuc ~S2() {
51*0a6a1f1dSLionel Sambuc a = 0;
52*0a6a1f1dSLionel Sambuc }
53*0a6a1f1dSLionel Sambuc };
54*0a6a1f1dSLionel Sambuc
55*0a6a1f1dSLionel Sambuc struct S3 {
56*0a6a1f1dSLionel Sambuc int a;
57*0a6a1f1dSLionel Sambuc float b;
S3S358*0a6a1f1dSLionel Sambuc S3()
59*0a6a1f1dSLionel Sambuc : a(0) {
60*0a6a1f1dSLionel Sambuc }
S3S361*0a6a1f1dSLionel Sambuc S3(int a)
62*0a6a1f1dSLionel Sambuc : a(a) {
63*0a6a1f1dSLionel Sambuc }
S3S364*0a6a1f1dSLionel Sambuc S3(const S3 &s) {
65*0a6a1f1dSLionel Sambuc a = 12 + s.a;
66*0a6a1f1dSLionel Sambuc }
~S3S367*0a6a1f1dSLionel Sambuc ~S3() {
68*0a6a1f1dSLionel Sambuc a = 0;
69*0a6a1f1dSLionel Sambuc }
70*0a6a1f1dSLionel Sambuc };
71*0a6a1f1dSLionel Sambuc
72*0a6a1f1dSLionel Sambuc struct S4 {
73*0a6a1f1dSLionel Sambuc int a, b;
S4S474*0a6a1f1dSLionel Sambuc S4()
75*0a6a1f1dSLionel Sambuc : a(0) {
76*0a6a1f1dSLionel Sambuc }
S4S477*0a6a1f1dSLionel Sambuc S4(int a)
78*0a6a1f1dSLionel Sambuc : a(a) {
79*0a6a1f1dSLionel Sambuc }
S4S480*0a6a1f1dSLionel Sambuc S4(const S4 &s) {
81*0a6a1f1dSLionel Sambuc a = 12 + s.a;
82*0a6a1f1dSLionel Sambuc }
~S4S483*0a6a1f1dSLionel Sambuc ~S4() {
84*0a6a1f1dSLionel Sambuc a = 0;
85*0a6a1f1dSLionel Sambuc }
86*0a6a1f1dSLionel Sambuc };
87*0a6a1f1dSLionel Sambuc
88*0a6a1f1dSLionel Sambuc struct S5 {
89*0a6a1f1dSLionel Sambuc int a, b, c;
S5S590*0a6a1f1dSLionel Sambuc S5()
91*0a6a1f1dSLionel Sambuc : a(0) {
92*0a6a1f1dSLionel Sambuc }
S5S593*0a6a1f1dSLionel Sambuc S5(int a)
94*0a6a1f1dSLionel Sambuc : a(a) {
95*0a6a1f1dSLionel Sambuc }
S5S596*0a6a1f1dSLionel Sambuc S5(const S5 &s) {
97*0a6a1f1dSLionel Sambuc a = 12 + s.a;
98*0a6a1f1dSLionel Sambuc }
~S5S599*0a6a1f1dSLionel Sambuc ~S5() {
100*0a6a1f1dSLionel Sambuc a = 0;
101*0a6a1f1dSLionel Sambuc }
102*0a6a1f1dSLionel Sambuc };
103*0a6a1f1dSLionel Sambuc
104*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[GS1:@.+]] = internal global [[S1]] zeroinitializer
105*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[GS1]].cache. = common global i8** null
106*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[DEFAULT_LOC:@.+]] = private unnamed_addr constant [[IDENT]] { i32 0, i32 2, i32 0, i32 0, i8* getelementptr inbounds ([{{[0-9]+}} x i8]* {{@.+}}, i32 0, i32 0) }
107*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[GS2:@.+]] = internal global [[S2]] zeroinitializer
108*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[ARR_X:@.+]] = global [2 x [3 x [[S1]]]] zeroinitializer
109*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[ARR_X]].cache. = common global i8** null
110*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[SM:@.+]] = internal global [[SMAIN]] zeroinitializer
111*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[SM]].cache. = common global i8** null
112*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[STATIC_S:@.+]] = external global [[S3]]
113*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[STATIC_S]].cache. = common global i8** null
114*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[GS3:@.+]] = external global [[S5]]
115*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[GS3]].cache. = common global i8** null
116*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[ST_INT_ST:@.+]] = linkonce_odr global i32 23
117*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[ST_INT_ST]].cache. = common global i8** null
118*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[ST_FLOAT_ST:@.+]] = linkonce_odr global float 2.300000e+01
119*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[ST_FLOAT_ST]].cache. = common global i8** null
120*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[ST_S4_ST:@.+]] = linkonce_odr global %struct.S4 zeroinitializer
121*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[ST_S4_ST]].cache. = common global i8** null
122*0a6a1f1dSLionel Sambuc // CHECK-NOT: .cache. = common global i8** null
123*0a6a1f1dSLionel Sambuc // There is no cache for gs2 - it is not threadprivate. Check that there is only
124*0a6a1f1dSLionel Sambuc // 8 caches created (for Static::s, gs1, gs3, arr_x, main::sm, ST<int>::st,
125*0a6a1f1dSLionel Sambuc // ST<float>::st, ST<S4>::st)
126*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[GS1:@.+]] = internal global [[S1]] zeroinitializer
127*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[GS2:@.+]] = internal global [[S2]] zeroinitializer
128*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[ARR_X:@.+]] = global [2 x [3 x [[S1]]]] zeroinitializer
129*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[SM:@.+]] = internal global [[SMAIN]] zeroinitializer
130*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[STATIC_S:@.+]] = external global [[S3]]
131*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[GS3:@.+]] = external global [[S5]]
132*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[ST_INT_ST:@.+]] = linkonce_odr global i32 23
133*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[ST_FLOAT_ST:@.+]] = linkonce_odr global float 2.300000e+01
134*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[ST_S4_ST:@.+]] = linkonce_odr global %struct.S4 zeroinitializer
135*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC1:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;162;9;;\00"
136*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC2:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;216;9;;\00"
137*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC3:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;303;19;;\00"
138*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC4:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;328;9;;\00"
139*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC5:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;341;9;;\00"
140*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC6:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;358;10;;\00"
141*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC7:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;375;10;;\00"
142*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC8:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;401;10;;\00"
143*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC9:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;422;10;;\00"
144*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC10:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;437;10;;\00"
145*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC11:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;454;27;;\00"
146*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC12:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;main;471;10;;\00"
147*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC13:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;550;9;;\00"
148*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC14:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;567;10;;\00"
149*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC15:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;593;10;;\00"
150*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC16:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;614;10;;\00"
151*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC17:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;629;10;;\00"
152*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC18:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;646;27;;\00"
153*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC19:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;foobar;663;10;;\00"
154*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-DAG: [[LOC20:@.*]] = private unnamed_addr constant [{{[0-9]+}} x i8] c";{{.*}}threadprivate_codegen.cpp;;275;9;;\00"
155*0a6a1f1dSLionel Sambuc
156*0a6a1f1dSLionel Sambuc struct Static {
157*0a6a1f1dSLionel Sambuc static S3 s;
158*0a6a1f1dSLionel Sambuc #pragma omp threadprivate(s)
159*0a6a1f1dSLionel Sambuc };
160*0a6a1f1dSLionel Sambuc
161*0a6a1f1dSLionel Sambuc static S1 gs1(5);
162*0a6a1f1dSLionel Sambuc #pragma omp threadprivate(gs1)
163*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} [[S1_CTOR:@.*]]([[S1]]* {{.*}},
164*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} [[S1_DTOR:@.*]]([[S1]]* {{.*}})
165*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}i8* [[GS1_CTOR:@\.__kmpc_global_ctor_\..*]](i8*)
166*0a6a1f1dSLionel Sambuc // CHECK: store i8* %0, i8** [[ARG_ADDR:%.*]],
167*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
168*0a6a1f1dSLionel Sambuc // CHECK: [[RES:%.*]] = bitcast i8* [[ARG]] to [[S1]]*
169*0a6a1f1dSLionel Sambuc // CHECK-NEXT: call {{.*}} [[S1_CTOR]]([[S1]]* [[RES]], {{.*}} 5)
170*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
171*0a6a1f1dSLionel Sambuc // CHECK: ret i8* [[ARG]]
172*0a6a1f1dSLionel Sambuc // CHECK-NEXT: }
173*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}void [[GS1_DTOR:@\.__kmpc_global_dtor_\..*]](i8*)
174*0a6a1f1dSLionel Sambuc // CHECK: store i8* %0, i8** [[ARG_ADDR:%.*]],
175*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
176*0a6a1f1dSLionel Sambuc // CHECK: [[RES:%.*]] = bitcast i8* [[ARG]] to [[S1]]*
177*0a6a1f1dSLionel Sambuc // CHECK-NEXT: call {{.*}} [[S1_DTOR]]([[S1]]* [[RES]])
178*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret void
179*0a6a1f1dSLionel Sambuc // CHECK-NEXT: }
180*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}void [[GS1_INIT:@\.__omp_threadprivate_init_\..*]]()
181*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}}void @__kmpc_threadprivate_register([[IDENT]]* [[DEFAULT_LOC]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i8* (i8*)* [[GS1_CTOR]], i8* (i8*, i8*)* null, void (i8*)* [[GS1_DTOR]])
182*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret void
183*0a6a1f1dSLionel Sambuc // CHECK-NEXT: }
184*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR:%.*]] = alloca [[IDENT]]
185*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
186*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC1]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
187*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: @__kmpc_global_thread_num
188*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: call {{.*}}void @__kmpc_threadprivate_register([[IDENT]]* [[KMPC_LOC_ADDR]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i8* (i8*)* [[GS1_CTOR:@\.__kmpc_global_ctor_\..*]], i8* (i8*, i8*)* null, void (i8*)* [[GS1_DTOR:@\.__kmpc_global_dtor_\..*]])
189*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define internal {{.*}}i8* [[GS1_CTOR]](i8*)
190*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: store i8* %0, i8** [[ARG_ADDR:%.*]],
191*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
192*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[RES:%.*]] = bitcast i8* [[ARG]] to [[S1]]*
193*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: call {{.*}} [[S1_CTOR:@.+]]([[S1]]* [[RES]], {{.*}} 5)
194*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
195*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: ret i8* [[ARG]]
196*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: }
197*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define {{.*}} [[S1_CTOR]]([[S1]]* {{.*}},
198*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define internal {{.*}}void [[GS1_DTOR]](i8*)
199*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: store i8* %0, i8** [[ARG_ADDR:%.*]],
200*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
201*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[RES:%.*]] = bitcast i8* [[ARG]] to [[S1]]*
202*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: call {{.*}} [[S1_DTOR:@.+]]([[S1]]* [[RES]])
203*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: ret void
204*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: }
205*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define {{.*}} [[S1_DTOR]]([[S1]]* {{.*}})
206*0a6a1f1dSLionel Sambuc static S2 gs2(27);
207*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} [[S2_CTOR:@.*]]([[S2]]* {{.*}},
208*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} [[S2_DTOR:@.*]]([[S2]]* {{.*}})
209*0a6a1f1dSLionel Sambuc // No another call for S2 constructor because it is not threadprivate
210*0a6a1f1dSLionel Sambuc // CHECK-NOT: call {{.*}} [[S2_CTOR]]([[S2]]*
211*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define {{.*}} [[S2_CTOR:@.*]]([[S2]]* {{.*}},
212*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define {{.*}} [[S2_DTOR:@.*]]([[S2]]* {{.*}})
213*0a6a1f1dSLionel Sambuc // No another call for S2 constructor because it is not threadprivate
214*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NOT: call {{.*}} [[S2_CTOR]]([[S2]]*
215*0a6a1f1dSLionel Sambuc S1 arr_x[2][3] = { { 1, 2, 3 }, { 4, 5, 6 } };
216*0a6a1f1dSLionel Sambuc #pragma omp threadprivate(arr_x)
217*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}i8* [[ARR_X_CTOR:@\.__kmpc_global_ctor_\..*]](i8*)
218*0a6a1f1dSLionel Sambuc // CHECK: store i8* %0, i8** [[ARG_ADDR:%.*]],
219*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
220*0a6a1f1dSLionel Sambuc // CHECK: [[RES:%.*]] = bitcast i8* [[ARG]] to [2 x [3 x [[S1]]]]*
221*0a6a1f1dSLionel Sambuc // CHECK: [[ARR1:%.*]] = getelementptr inbounds [2 x [3 x [[S1]]]]* [[RES]], i{{.*}} 0, i{{.*}} 0
222*0a6a1f1dSLionel Sambuc // CHECK: [[ARR:%.*]] = getelementptr inbounds [3 x [[S1]]]* [[ARR1]], i{{.*}} 0, i{{.*}} 0
223*0a6a1f1dSLionel Sambuc // CHECK: invoke {{.*}} [[S1_CTOR]]([[S1]]* [[ARR]], [[INT]] {{.*}}1)
224*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_ELEMENT:%.*]] = getelementptr inbounds [[S1]]* [[ARR]], i{{.*}} 1
225*0a6a1f1dSLionel Sambuc // CHECK: invoke {{.*}} [[S1_CTOR]]([[S1]]* [[ARR_ELEMENT]], [[INT]] {{.*}}2)
226*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_ELEMENT2:%.*]] = getelementptr inbounds [[S1]]* [[ARR_ELEMENT]], i{{.*}} 1
227*0a6a1f1dSLionel Sambuc // CHECK: invoke {{.*}} [[S1_CTOR]]([[S1]]* [[ARR_ELEMENT2]], [[INT]] {{.*}}3)
228*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_ELEMENT3:%.*]] = getelementptr inbounds [3 x [[S1]]]* [[ARR1]], i{{.*}} 1
229*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_:%.*]] = getelementptr inbounds [3 x [[S1]]]* [[ARR_ELEMENT3]], i{{.*}} 0, i{{.*}} 0
230*0a6a1f1dSLionel Sambuc // CHECK: invoke {{.*}} [[S1_CTOR]]([[S1]]* [[ARR_]], [[INT]] {{.*}}4)
231*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_ELEMENT:%.*]] = getelementptr inbounds [[S1]]* [[ARR_]], i{{.*}} 1
232*0a6a1f1dSLionel Sambuc // CHECK: invoke {{.*}} [[S1_CTOR]]([[S1]]* [[ARR_ELEMENT]], [[INT]] {{.*}}5)
233*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_ELEMENT2:%.*]] = getelementptr inbounds [[S1]]* [[ARR_ELEMENT]], i{{.*}} 1
234*0a6a1f1dSLionel Sambuc // CHECK: invoke {{.*}} [[S1_CTOR]]([[S1]]* [[ARR_ELEMENT2]], [[INT]] {{.*}}6)
235*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
236*0a6a1f1dSLionel Sambuc // CHECK: ret i8* [[ARG]]
237*0a6a1f1dSLionel Sambuc // CHECK: }
238*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}void [[ARR_X_DTOR:@\.__kmpc_global_dtor_\..*]](i8*)
239*0a6a1f1dSLionel Sambuc // CHECK: store i8* %0, i8** [[ARG_ADDR:%.*]],
240*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
241*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_BEGIN:%.*]] = bitcast i8* [[ARG]] to [[S1]]*
242*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_CUR:%.*]] = getelementptr inbounds [[S1]]* [[ARR_BEGIN]], i{{.*}} 6
243*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br label %[[ARR_LOOP:.*]]
244*0a6a1f1dSLionel Sambuc // CHECK: {{.*}}[[ARR_LOOP]]{{.*}}
245*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_ELEMENTPAST:%.*]] = phi [[S1]]* [ [[ARR_CUR]], {{.*}} ], [ [[ARR_ELEMENT:%.*]], {{.*}} ]
246*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_ELEMENT:%.*]] = getelementptr inbounds [[S1]]* [[ARR_ELEMENTPAST]], i{{.*}} -1
247*0a6a1f1dSLionel Sambuc // CHECK-NEXT: invoke {{.*}} [[S1_DTOR]]([[S1]]* [[ARR_ELEMENT]])
248*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_DONE:%.*]] = icmp eq [[S1]]* [[ARR_ELEMENT]], [[ARR_BEGIN]]
249*0a6a1f1dSLionel Sambuc // CHECK-NEXT: br i1 [[ARR_DONE]], label %[[ARR_EXIT:.*]], label %[[ARR_LOOP]]
250*0a6a1f1dSLionel Sambuc // CHECK: {{.*}}[[ARR_EXIT]]{{.*}}
251*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret void
252*0a6a1f1dSLionel Sambuc // CHECK: }
253*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}void [[ARR_X_INIT:@\.__omp_threadprivate_init_\..*]]()
254*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}}void @__kmpc_threadprivate_register([[IDENT]]* [[DEFAULT_LOC]], i8* bitcast ([2 x [3 x [[S1]]]]* [[ARR_X]] to i8*), i8* (i8*)* [[ARR_X_CTOR]], i8* (i8*, i8*)* null, void (i8*)* [[ARR_X_DTOR]])
255*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret void
256*0a6a1f1dSLionel Sambuc // CHECK-NEXT: }
257*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR:%.*]] = alloca [[IDENT]]
258*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
259*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC2]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
260*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: @__kmpc_global_thread_num
261*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: call {{.*}}void @__kmpc_threadprivate_register([[IDENT]]* [[KMPC_LOC_ADDR]], i8* bitcast ([2 x [3 x [[S1]]]]* [[ARR_X]] to i8*), i8* (i8*)* [[ARR_X_CTOR:@\.__kmpc_global_ctor_\..*]], i8* (i8*, i8*)* null, void (i8*)* [[ARR_X_DTOR:@\.__kmpc_global_dtor_\..*]])
262*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define internal {{.*}}i8* [[ARR_X_CTOR]](i8*)
263*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: }
264*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define internal {{.*}}void [[ARR_X_DTOR]](i8*)
265*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: }
266*0a6a1f1dSLionel Sambuc extern S5 gs3;
267*0a6a1f1dSLionel Sambuc #pragma omp threadprivate(gs3)
268*0a6a1f1dSLionel Sambuc // No call for S5 constructor because gs3 has just declaration, not a definition.
269*0a6a1f1dSLionel Sambuc // CHECK-NOT: call {{.*}}([[S5]]*
270*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NOT: call {{.*}}([[S5]]*
271*0a6a1f1dSLionel Sambuc
272*0a6a1f1dSLionel Sambuc template <class T>
273*0a6a1f1dSLionel Sambuc struct ST {
274*0a6a1f1dSLionel Sambuc static T st;
275*0a6a1f1dSLionel Sambuc #pragma omp threadprivate(st)
276*0a6a1f1dSLionel Sambuc };
277*0a6a1f1dSLionel Sambuc
278*0a6a1f1dSLionel Sambuc template <class T>
279*0a6a1f1dSLionel Sambuc T ST<T>::st(23);
280*0a6a1f1dSLionel Sambuc
281*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @main()
282*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-LABEL: @main()
main()283*0a6a1f1dSLionel Sambuc int main() {
284*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR:%.*]] = alloca [[IDENT]]
285*0a6a1f1dSLionel Sambuc int Res;
286*0a6a1f1dSLionel Sambuc struct Smain {
287*0a6a1f1dSLionel Sambuc int a;
288*0a6a1f1dSLionel Sambuc double b, c;
289*0a6a1f1dSLionel Sambuc Smain()
290*0a6a1f1dSLionel Sambuc : a(0) {
291*0a6a1f1dSLionel Sambuc }
292*0a6a1f1dSLionel Sambuc Smain(int a)
293*0a6a1f1dSLionel Sambuc : a(a) {
294*0a6a1f1dSLionel Sambuc }
295*0a6a1f1dSLionel Sambuc Smain(const Smain &s) {
296*0a6a1f1dSLionel Sambuc a = 12 + s.a;
297*0a6a1f1dSLionel Sambuc }
298*0a6a1f1dSLionel Sambuc ~Smain() {
299*0a6a1f1dSLionel Sambuc a = 0;
300*0a6a1f1dSLionel Sambuc }
301*0a6a1f1dSLionel Sambuc };
302*0a6a1f1dSLionel Sambuc
303*0a6a1f1dSLionel Sambuc static Smain sm(gs1.a);
304*0a6a1f1dSLionel Sambuc // CHECK: [[THREAD_NUM:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT]]* [[DEFAULT_LOC]])
305*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}}i{{.*}} @__cxa_guard_acquire
306*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}}i32 @__kmpc_global_thread_num([[IDENT]]* [[DEFAULT_LOC]])
307*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}}void @__kmpc_threadprivate_register([[IDENT]]* [[DEFAULT_LOC]], i8* bitcast ([[SMAIN]]* [[SM]] to i8*), i8* (i8*)* [[SM_CTOR:@\.__kmpc_global_ctor_\..+]], i8* (i8*, i8*)* null, void (i8*)* [[SM_DTOR:@\.__kmpc_global_dtor_\..+]])
308*0a6a1f1dSLionel Sambuc // CHECK: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS1]].cache.)
309*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]*
310*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0
311*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_A:%.*]] = load [[INT]]* [[GS1_A_ADDR]]
312*0a6a1f1dSLionel Sambuc // CHECK-NEXT: invoke {{.*}} [[SMAIN_CTOR:.*]]([[SMAIN]]* [[SM]], [[INT]] {{.*}}[[GS1_A]])
313*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}}void @__cxa_guard_release
314*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
315*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC3]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
316*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[THREAD_NUM:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT]]* [[KMPC_LOC_ADDR]])
317*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: call {{.*}}i{{.*}} @__cxa_guard_acquire
318*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: call {{.*}}i32 @__kmpc_global_thread_num([[IDENT]]* [[KMPC_LOC_ADDR]])
319*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: call {{.*}}void @__kmpc_threadprivate_register([[IDENT]]* [[KMPC_LOC_ADDR]], i8* bitcast ([[SMAIN]]* [[SM]] to i8*), i8* (i8*)* [[SM_CTOR:@\.__kmpc_global_ctor_\..+]], i8* (i8*, i8*)* null, void (i8*)* [[SM_DTOR:@\.__kmpc_global_dtor_\..+]])
320*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
321*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC3]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
322*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8***
323*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]*
324*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0
325*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_A:%.*]] = load [[INT]]* [[GS1_A_ADDR]]
326*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: invoke {{.*}} [[SMAIN_CTOR:.*]]([[SMAIN]]* [[SM]], [[INT]] {{.*}}[[GS1_A]])
327*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: call {{.*}}void @__cxa_guard_release
328*0a6a1f1dSLionel Sambuc #pragma omp threadprivate(sm)
329*0a6a1f1dSLionel Sambuc // CHECK: [[STATIC_S_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S3]]* [[STATIC_S]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[STATIC_S]].cache.)
330*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[STATIC_S_ADDR:%.*]] = bitcast i8* [[STATIC_S_TEMP_ADDR]] to [[S3]]*
331*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[STATIC_S_A_ADDR:%.*]] = getelementptr inbounds [[S3]]* [[STATIC_S_ADDR]], i{{.*}} 0, i{{.*}} 0
332*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[STATIC_S_A:%.*]] = load [[INT]]* [[STATIC_S_A_ADDR]]
333*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[STATIC_S_A]], [[INT]]* [[RES_ADDR:[^,]+]]
334*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
335*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC5]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
336*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[STATIC_S_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S3]]* [[STATIC_S]] to i8*), i{{.*}} {{[0-9]+}}, i8***
337*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[STATIC_S_ADDR:%.*]] = bitcast i8* [[STATIC_S_TEMP_ADDR]] to [[S3]]*
338*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[STATIC_S_A_ADDR:%.*]] = getelementptr inbounds [[S3]]* [[STATIC_S_ADDR]], i{{.*}} 0, i{{.*}} 0
339*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[STATIC_S_A:%.*]] = load [[INT]]* [[STATIC_S_A_ADDR]]
340*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[STATIC_S_A]], [[INT]]* [[RES_ADDR:[^,]+]]
341*0a6a1f1dSLionel Sambuc Res = Static::s.a;
342*0a6a1f1dSLionel Sambuc // CHECK: [[SM_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[SMAIN]]* [[SM]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[SM]].cache.)
343*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[SM_ADDR:%.*]] = bitcast i8* [[SM_TEMP_ADDR]] to [[SMAIN]]*
344*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[SM_A_ADDR:%.*]] = getelementptr inbounds [[SMAIN]]* [[SM_ADDR]], i{{.*}} 0, i{{.*}} 0
345*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[SM_A:%.*]] = load [[INT]]* [[SM_A_ADDR]]
346*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
347*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[SM_A]]
348*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
349*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
350*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC6]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
351*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[SM_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[SMAIN]]* [[SM]] to i8*), i{{.*}} {{[0-9]+}}, i8***
352*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[SM_ADDR:%.*]] = bitcast i8* [[SM_TEMP_ADDR]] to [[SMAIN]]*
353*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[SM_A_ADDR:%.*]] = getelementptr inbounds [[SMAIN]]* [[SM_ADDR]], i{{.*}} 0, i{{.*}} 0
354*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[SM_A:%.*]] = load [[INT]]* [[SM_A_ADDR]]
355*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
356*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[SM_A]]
357*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
358*0a6a1f1dSLionel Sambuc Res += sm.a;
359*0a6a1f1dSLionel Sambuc // CHECK: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS1]].cache.)
360*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]*
361*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0
362*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_A:%.*]] = load [[INT]]* [[GS1_A_ADDR]]
363*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
364*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS1_A]]
365*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
366*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
367*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC7]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
368*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8***
369*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]*
370*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0
371*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_A:%.*]] = load [[INT]]* [[GS1_A_ADDR]]
372*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
373*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS1_A]]
374*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
375*0a6a1f1dSLionel Sambuc Res += gs1.a;
376*0a6a1f1dSLionel Sambuc // CHECK: [[GS2_A:%.*]] = load [[INT]]* getelementptr inbounds ([[S2]]* [[GS2]], i{{.*}} 0, i{{.*}} 0)
377*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
378*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS2_A]]
379*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
380*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[GS2_A:%.*]] = load [[INT]]* getelementptr inbounds ([[S2]]* [[GS2]], i{{.*}} 0, i{{.*}} 0)
381*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
382*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS2_A]]
383*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
384*0a6a1f1dSLionel Sambuc Res += gs2.a;
385*0a6a1f1dSLionel Sambuc // CHECK: [[GS3_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S5]]* [[GS3]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS3]].cache.)
386*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS3_ADDR:%.*]] = bitcast i8* [[GS3_TEMP_ADDR]] to [[S5]]*
387*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS3_A_ADDR:%.*]] = getelementptr inbounds [[S5]]* [[GS3_ADDR]], i{{.*}} 0, i{{.*}} 0
388*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS3_A:%.*]] = load [[INT]]* [[GS3_A_ADDR]]
389*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
390*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS3_A]]
391*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
392*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
393*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC8]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
394*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS3_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S5]]* [[GS3]] to i8*), i{{.*}} {{[0-9]+}}, i8***
395*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS3_ADDR:%.*]] = bitcast i8* [[GS3_TEMP_ADDR]] to [[S5]]*
396*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS3_A_ADDR:%.*]] = getelementptr inbounds [[S5]]* [[GS3_ADDR]], i{{.*}} 0, i{{.*}} 0
397*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS3_A:%.*]] = load [[INT]]* [[GS3_A_ADDR]]
398*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
399*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS3_A]]
400*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
401*0a6a1f1dSLionel Sambuc Res += gs3.a;
402*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_X_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([2 x [3 x [[S1]]]]* [[ARR_X]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ARR_X]].cache.)
403*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_ADDR:%.*]] = bitcast i8* [[ARR_X_TEMP_ADDR]] to [2 x [3 x [[S1]]]]*
404*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_1_ADDR:%.*]] = getelementptr inbounds [2 x [3 x [[S1]]]]* [[ARR_X_ADDR]], i{{.*}} 0, i{{.*}} 1
405*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_1_1_ADDR:%.*]] = getelementptr inbounds [3 x [[S1]]]* [[ARR_X_1_ADDR]], i{{.*}} 0, i{{.*}} 1
406*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_1_1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[ARR_X_1_1_ADDR]], i{{.*}} 0, i{{.*}} 0
407*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_1_1_A:%.*]] = load [[INT]]* [[ARR_X_1_1_A_ADDR]]
408*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
409*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ARR_X_1_1_A]]
410*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
411*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
412*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC9]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
413*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([2 x [3 x [[S1]]]]* [[ARR_X]] to i8*), i{{.*}} {{[0-9]+}}, i8***
414*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_ADDR:%.*]] = bitcast i8* [[ARR_X_TEMP_ADDR]] to [2 x [3 x [[S1]]]]*
415*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_1_ADDR:%.*]] = getelementptr inbounds [2 x [3 x [[S1]]]]* [[ARR_X_ADDR]], i{{.*}} 0, i{{.*}} 1
416*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_1_1_ADDR:%.*]] = getelementptr inbounds [3 x [[S1]]]* [[ARR_X_1_ADDR]], i{{.*}} 0, i{{.*}} 1
417*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_1_1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[ARR_X_1_1_ADDR]], i{{.*}} 0, i{{.*}} 0
418*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_1_1_A:%.*]] = load [[INT]]* [[ARR_X_1_1_A_ADDR]]
419*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
420*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ARR_X_1_1_A]]
421*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
422*0a6a1f1dSLionel Sambuc Res += arr_x[1][1].a;
423*0a6a1f1dSLionel Sambuc // CHECK: [[ST_INT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[INT]]* [[ST_INT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_INT_ST]].cache.)
424*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_INT_ST_ADDR:%.*]] = bitcast i8* [[ST_INT_ST_TEMP_ADDR]] to [[INT]]*
425*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_INT_ST_VAL:%.*]] = load [[INT]]* [[ST_INT_ST_ADDR]]
426*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
427*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_INT_ST_VAL]]
428*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
429*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
430*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC10]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
431*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_INT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[INT]]* [[ST_INT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8***
432*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_INT_ST_ADDR:%.*]] = bitcast i8* [[ST_INT_ST_TEMP_ADDR]] to [[INT]]*
433*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_INT_ST_VAL:%.*]] = load [[INT]]* [[ST_INT_ST_ADDR]]
434*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
435*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_INT_ST_VAL]]
436*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
437*0a6a1f1dSLionel Sambuc Res += ST<int>::st;
438*0a6a1f1dSLionel Sambuc // CHECK: [[ST_FLOAT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast (float* [[ST_FLOAT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_FLOAT_ST]].cache.)
439*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_FLOAT_ST_ADDR:%.*]] = bitcast i8* [[ST_FLOAT_ST_TEMP_ADDR]] to float*
440*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_FLOAT_ST_VAL:%.*]] = load float* [[ST_FLOAT_ST_ADDR]]
441*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[FLOAT_TO_INT_CONV:%.*]] = fptosi float [[ST_FLOAT_ST_VAL]] to [[INT]]
442*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
443*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[FLOAT_TO_INT_CONV]]
444*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
445*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
446*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC11]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
447*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_FLOAT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast (float* [[ST_FLOAT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8***
448*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_FLOAT_ST_ADDR:%.*]] = bitcast i8* [[ST_FLOAT_ST_TEMP_ADDR]] to float*
449*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_FLOAT_ST_VAL:%.*]] = load float* [[ST_FLOAT_ST_ADDR]]
450*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[FLOAT_TO_INT_CONV:%.*]] = fptosi float [[ST_FLOAT_ST_VAL]] to [[INT]]
451*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
452*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[FLOAT_TO_INT_CONV]]
453*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
454*0a6a1f1dSLionel Sambuc Res += static_cast<int>(ST<float>::st);
455*0a6a1f1dSLionel Sambuc // CHECK: [[ST_S4_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S4]]* [[ST_S4_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_S4_ST]].cache.)
456*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_S4_ST_ADDR:%.*]] = bitcast i8* [[ST_S4_ST_TEMP_ADDR]] to [[S4]]*
457*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_S4_ST_A_ADDR:%.*]] = getelementptr inbounds [[S4]]* [[ST_S4_ST_ADDR]], i{{.*}} 0, i{{.*}} 0
458*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_S4_ST_A:%.*]] = load [[INT]]* [[ST_S4_ST_A_ADDR]]
459*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
460*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_S4_ST_A]]
461*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
462*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
463*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC12]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
464*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_S4_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S4]]* [[ST_S4_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8***
465*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_S4_ST_ADDR:%.*]] = bitcast i8* [[ST_S4_ST_TEMP_ADDR]] to [[S4]]*
466*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_S4_ST_A_ADDR:%.*]] = getelementptr inbounds [[S4]]* [[ST_S4_ST_ADDR]], i{{.*}} 0, i{{.*}} 0
467*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_S4_ST_A:%.*]] = load [[INT]]* [[ST_S4_ST_A_ADDR]]
468*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
469*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_S4_ST_A]]
470*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
471*0a6a1f1dSLionel Sambuc Res += ST<S4>::st.a;
472*0a6a1f1dSLionel Sambuc // CHECK: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
473*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret [[INT]] [[RES]]
474*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
475*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: ret [[INT]] [[RES]]
476*0a6a1f1dSLionel Sambuc return Res;
477*0a6a1f1dSLionel Sambuc }
478*0a6a1f1dSLionel Sambuc // CHECK: }
479*0a6a1f1dSLionel Sambuc
480*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}i8* [[SM_CTOR]](i8*)
481*0a6a1f1dSLionel Sambuc // CHECK: [[THREAD_NUM:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT]]* [[DEFAULT_LOC]])
482*0a6a1f1dSLionel Sambuc // CHECK: store i8* %0, i8** [[ARG_ADDR:%.*]],
483*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
484*0a6a1f1dSLionel Sambuc // CHECK: [[RES:%.*]] = bitcast i8* [[ARG]] to [[SMAIN]]*
485*0a6a1f1dSLionel Sambuc // CHECK: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS1]].cache.)
486*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]*
487*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0
488*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_A:%.*]] = load [[INT]]* [[GS1_A_ADDR]]
489*0a6a1f1dSLionel Sambuc // CHECK-NEXT: call {{.*}} [[SMAIN_CTOR:@.+]]([[SMAIN]]* [[RES]], [[INT]] {{.*}}[[GS1_A]])
490*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
491*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret i8* [[ARG]]
492*0a6a1f1dSLionel Sambuc // CHECK-NEXT: }
493*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} [[SMAIN_CTOR]]([[SMAIN]]* {{.*}},
494*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}void [[SM_DTOR]](i8*)
495*0a6a1f1dSLionel Sambuc // CHECK: store i8* %0, i8** [[ARG_ADDR:%.*]],
496*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
497*0a6a1f1dSLionel Sambuc // CHECK: [[RES:%.*]] = bitcast i8* [[ARG]] to [[SMAIN]]*
498*0a6a1f1dSLionel Sambuc // CHECK-NEXT: call {{.*}} [[SMAIN_DTOR:@.+]]([[SMAIN]]* [[RES]])
499*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret void
500*0a6a1f1dSLionel Sambuc // CHECK-NEXT: }
501*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} [[SMAIN_DTOR]]([[SMAIN]]* {{.*}})
502*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define internal {{.*}}i8* [[SM_CTOR]](i8*)
503*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR:%.*]] = alloca [[IDENT]]
504*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
505*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC3]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
506*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[THREAD_NUM:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT]]* [[KMPC_LOC_ADDR]])
507*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: store i8* %0, i8** [[ARG_ADDR:%.*]],
508*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
509*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[RES:%.*]] = bitcast i8* [[ARG]] to [[SMAIN]]*
510*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
511*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC3]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
512*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8***
513*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]*
514*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0
515*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_A:%.*]] = load [[INT]]* [[GS1_A_ADDR]]
516*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: call {{.*}} [[SMAIN_CTOR:@.+]]([[SMAIN]]* [[RES]], [[INT]] {{.*}}[[GS1_A]])
517*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
518*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: ret i8* [[ARG]]
519*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: }
520*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define {{.*}} [[SMAIN_CTOR]]([[SMAIN]]* {{.*}},
521*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define internal {{.*}} [[SM_DTOR:@.+]](i8*)
522*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: call {{.*}} [[SMAIN_DTOR:@.+]]([[SMAIN]]*
523*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: }
524*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define {{.*}} [[SMAIN_DTOR]]([[SMAIN]]* {{.*}})
525*0a6a1f1dSLionel Sambuc
526*0a6a1f1dSLionel Sambuc #endif
527*0a6a1f1dSLionel Sambuc
528*0a6a1f1dSLionel Sambuc #ifdef BODY
529*0a6a1f1dSLionel Sambuc // CHECK-LABEL: @{{.*}}foobar{{.*}}()
530*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-LABEL: @{{.*}}foobar{{.*}}()
foobar()531*0a6a1f1dSLionel Sambuc int foobar() {
532*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR:%.*]] = alloca [[IDENT]]
533*0a6a1f1dSLionel Sambuc int Res;
534*0a6a1f1dSLionel Sambuc // CHECK: [[THREAD_NUM:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT]]* [[DEFAULT_LOC]])
535*0a6a1f1dSLionel Sambuc // CHECK: [[STATIC_S_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S3]]* [[STATIC_S]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[STATIC_S]].cache.)
536*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[STATIC_S_ADDR:%.*]] = bitcast i8* [[STATIC_S_TEMP_ADDR]] to [[S3]]*
537*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[STATIC_S_A_ADDR:%.*]] = getelementptr inbounds [[S3]]* [[STATIC_S_ADDR]], i{{.*}} 0, i{{.*}} 0
538*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[STATIC_S_A:%.*]] = load [[INT]]* [[STATIC_S_A_ADDR]]
539*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[STATIC_S_A]], [[INT]]* [[RES_ADDR:[^,]+]]
540*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
541*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC13]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
542*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[THREAD_NUM:%.+]] = call {{.*}}i32 @__kmpc_global_thread_num([[IDENT]]* [[KMPC_LOC_ADDR]])
543*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
544*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC13]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
545*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[STATIC_S_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S3]]* [[STATIC_S]] to i8*), i{{.*}} {{[0-9]+}}, i8***
546*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[STATIC_S_ADDR:%.*]] = bitcast i8* [[STATIC_S_TEMP_ADDR]] to [[S3]]*
547*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[STATIC_S_A_ADDR:%.*]] = getelementptr inbounds [[S3]]* [[STATIC_S_ADDR]], i{{.*}} 0, i{{.*}} 0
548*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[STATIC_S_A:%.*]] = load [[INT]]* [[STATIC_S_A_ADDR]]
549*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[STATIC_S_A]], [[INT]]* [[RES_ADDR:[^,]+]]
550*0a6a1f1dSLionel Sambuc Res = Static::s.a;
551*0a6a1f1dSLionel Sambuc // CHECK: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS1]].cache.)
552*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]*
553*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0
554*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS1_A:%.*]] = load [[INT]]* [[GS1_A_ADDR]]
555*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
556*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS1_A]]
557*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
558*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
559*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC14]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
560*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S1]]* [[GS1]] to i8*), i{{.*}} {{[0-9]+}}, i8***
561*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_ADDR:%.*]] = bitcast i8* [[GS1_TEMP_ADDR]] to [[S1]]*
562*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[GS1_ADDR]], i{{.*}} 0, i{{.*}} 0
563*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS1_A:%.*]] = load [[INT]]* [[GS1_A_ADDR]]
564*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
565*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS1_A]]
566*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
567*0a6a1f1dSLionel Sambuc Res += gs1.a;
568*0a6a1f1dSLionel Sambuc // CHECK: [[GS2_A:%.*]] = load [[INT]]* getelementptr inbounds ([[S2]]* [[GS2]], i{{.*}} 0, i{{.*}} 0)
569*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
570*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS2_A]]
571*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
572*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[GS2_A:%.*]] = load [[INT]]* getelementptr inbounds ([[S2]]* [[GS2]], i{{.*}} 0, i{{.*}} 0)
573*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
574*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS2_A]]
575*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
576*0a6a1f1dSLionel Sambuc Res += gs2.a;
577*0a6a1f1dSLionel Sambuc // CHECK: [[GS3_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S5]]* [[GS3]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[GS3]].cache.)
578*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS3_ADDR:%.*]] = bitcast i8* [[GS3_TEMP_ADDR]] to [[S5]]*
579*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS3_A_ADDR:%.*]] = getelementptr inbounds [[S5]]* [[GS3_ADDR]], i{{.*}} 0, i{{.*}} 0
580*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[GS3_A:%.*]] = load [[INT]]* [[GS3_A_ADDR]]
581*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
582*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS3_A]]
583*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
584*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
585*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC15]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
586*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS3_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S5]]* [[GS3]] to i8*), i{{.*}} {{[0-9]+}}, i8***
587*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS3_ADDR:%.*]] = bitcast i8* [[GS3_TEMP_ADDR]] to [[S5]]*
588*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS3_A_ADDR:%.*]] = getelementptr inbounds [[S5]]* [[GS3_ADDR]], i{{.*}} 0, i{{.*}} 0
589*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[GS3_A:%.*]] = load [[INT]]* [[GS3_A_ADDR]]
590*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
591*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[GS3_A]]
592*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
593*0a6a1f1dSLionel Sambuc Res += gs3.a;
594*0a6a1f1dSLionel Sambuc // CHECK: [[ARR_X_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([2 x [3 x [[S1]]]]* [[ARR_X]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ARR_X]].cache.)
595*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_ADDR:%.*]] = bitcast i8* [[ARR_X_TEMP_ADDR]] to [2 x [3 x [[S1]]]]*
596*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_1_ADDR:%.*]] = getelementptr inbounds [2 x [3 x [[S1]]]]* [[ARR_X_ADDR]], i{{.*}} 0, i{{.*}} 1
597*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_1_1_ADDR:%.*]] = getelementptr inbounds [3 x [[S1]]]* [[ARR_X_1_ADDR]], i{{.*}} 0, i{{.*}} 1
598*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_1_1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[ARR_X_1_1_ADDR]], i{{.*}} 0, i{{.*}} 0
599*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ARR_X_1_1_A:%.*]] = load [[INT]]* [[ARR_X_1_1_A_ADDR]]
600*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
601*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ARR_X_1_1_A]]
602*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
603*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
604*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC16]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
605*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([2 x [3 x [[S1]]]]* [[ARR_X]] to i8*), i{{.*}} {{[0-9]+}}, i8***
606*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_ADDR:%.*]] = bitcast i8* [[ARR_X_TEMP_ADDR]] to [2 x [3 x [[S1]]]]*
607*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_1_ADDR:%.*]] = getelementptr inbounds [2 x [3 x [[S1]]]]* [[ARR_X_ADDR]], i{{.*}} 0, i{{.*}} 1
608*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_1_1_ADDR:%.*]] = getelementptr inbounds [3 x [[S1]]]* [[ARR_X_1_ADDR]], i{{.*}} 0, i{{.*}} 1
609*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_1_1_A_ADDR:%.*]] = getelementptr inbounds [[S1]]* [[ARR_X_1_1_ADDR]], i{{.*}} 0, i{{.*}} 0
610*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ARR_X_1_1_A:%.*]] = load [[INT]]* [[ARR_X_1_1_A_ADDR]]
611*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
612*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ARR_X_1_1_A]]
613*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
614*0a6a1f1dSLionel Sambuc Res += arr_x[1][1].a;
615*0a6a1f1dSLionel Sambuc // CHECK: [[ST_INT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[INT]]* [[ST_INT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_INT_ST]].cache.)
616*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_INT_ST_ADDR:%.*]] = bitcast i8* [[ST_INT_ST_TEMP_ADDR]] to [[INT]]*
617*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_INT_ST_VAL:%.*]] = load [[INT]]* [[ST_INT_ST_ADDR]]
618*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
619*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_INT_ST_VAL]]
620*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
621*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
622*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC17]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
623*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_INT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[INT]]* [[ST_INT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8***
624*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_INT_ST_ADDR:%.*]] = bitcast i8* [[ST_INT_ST_TEMP_ADDR]] to [[INT]]*
625*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_INT_ST_VAL:%.*]] = load [[INT]]* [[ST_INT_ST_ADDR]]
626*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
627*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_INT_ST_VAL]]
628*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
629*0a6a1f1dSLionel Sambuc Res += ST<int>::st;
630*0a6a1f1dSLionel Sambuc // CHECK: [[ST_FLOAT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast (float* [[ST_FLOAT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_FLOAT_ST]].cache.)
631*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_FLOAT_ST_ADDR:%.*]] = bitcast i8* [[ST_FLOAT_ST_TEMP_ADDR]] to float*
632*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_FLOAT_ST_VAL:%.*]] = load float* [[ST_FLOAT_ST_ADDR]]
633*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[FLOAT_TO_INT_CONV:%.*]] = fptosi float [[ST_FLOAT_ST_VAL]] to [[INT]]
634*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
635*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[FLOAT_TO_INT_CONV]]
636*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
637*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
638*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC18]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
639*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_FLOAT_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast (float* [[ST_FLOAT_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8***
640*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_FLOAT_ST_ADDR:%.*]] = bitcast i8* [[ST_FLOAT_ST_TEMP_ADDR]] to float*
641*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_FLOAT_ST_VAL:%.*]] = load float* [[ST_FLOAT_ST_ADDR]]
642*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[FLOAT_TO_INT_CONV:%.*]] = fptosi float [[ST_FLOAT_ST_VAL]] to [[INT]]
643*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
644*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[FLOAT_TO_INT_CONV]]
645*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
646*0a6a1f1dSLionel Sambuc Res += static_cast<int>(ST<float>::st);
647*0a6a1f1dSLionel Sambuc // CHECK: [[ST_S4_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[DEFAULT_LOC]], i32 [[THREAD_NUM]], i8* bitcast ([[S4]]* [[ST_S4_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8*** [[ST_S4_ST]].cache.)
648*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_S4_ST_ADDR:%.*]] = bitcast i8* [[ST_S4_ST_TEMP_ADDR]] to [[S4]]*
649*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_S4_ST_A_ADDR:%.*]] = getelementptr inbounds [[S4]]* [[ST_S4_ST_ADDR]], i{{.*}} 0, i{{.*}} 0
650*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ST_S4_ST_A:%.*]] = load [[INT]]* [[ST_S4_ST_A_ADDR]]
651*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
652*0a6a1f1dSLionel Sambuc // CHECK-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_S4_ST_A]]
653*0a6a1f1dSLionel Sambuc // CHECK-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
654*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
655*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC19]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
656*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_S4_ST_TEMP_ADDR:%.*]] = call {{.*}}i8* @__kmpc_threadprivate_cached([[IDENT]]* [[KMPC_LOC_ADDR]], i32 [[THREAD_NUM]], i8* bitcast ([[S4]]* [[ST_S4_ST]] to i8*), i{{.*}} {{[0-9]+}}, i8***
657*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_S4_ST_ADDR:%.*]] = bitcast i8* [[ST_S4_ST_TEMP_ADDR]] to [[S4]]*
658*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_S4_ST_A_ADDR:%.*]] = getelementptr inbounds [[S4]]* [[ST_S4_ST_ADDR]], i{{.*}} 0, i{{.*}} 0
659*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ST_S4_ST_A:%.*]] = load [[INT]]* [[ST_S4_ST_A_ADDR]]
660*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
661*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: [[ADD:%.*]] = add {{.*}} [[INT]] [[RES]], [[ST_S4_ST_A]]
662*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store [[INT]] [[ADD]], [[INT]]* [[RES:.+]]
663*0a6a1f1dSLionel Sambuc Res += ST<S4>::st.a;
664*0a6a1f1dSLionel Sambuc // CHECK: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
665*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret [[INT]] [[RES]]
666*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[RES:%.*]] = load [[INT]]* [[RES_ADDR]]
667*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: ret [[INT]] [[RES]]
668*0a6a1f1dSLionel Sambuc return Res;
669*0a6a1f1dSLionel Sambuc }
670*0a6a1f1dSLionel Sambuc #endif
671*0a6a1f1dSLionel Sambuc
672*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}}void @__kmpc_threadprivate_register([[IDENT]]* [[DEFAULT_LOC]], i8* bitcast ([[S4]]* [[ST_S4_ST]] to i8*), i8* (i8*)* [[ST_S4_ST_CTOR:@\.__kmpc_global_ctor_\..+]], i8* (i8*, i8*)* null, void (i8*)* [[ST_S4_ST_DTOR:@\.__kmpc_global_dtor_\..+]])
673*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}i8* [[ST_S4_ST_CTOR]](i8*)
674*0a6a1f1dSLionel Sambuc // CHECK: store i8* %0, i8** [[ARG_ADDR:%.*]],
675*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
676*0a6a1f1dSLionel Sambuc // CHECK: [[RES:%.*]] = bitcast i8* [[ARG]] to [[S4]]*
677*0a6a1f1dSLionel Sambuc // CHECK-NEXT: call {{.*}} [[S4_CTOR:@.+]]([[S4]]* [[RES]], {{.*}} 23)
678*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
679*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret i8* [[ARG]]
680*0a6a1f1dSLionel Sambuc // CHECK-NEXT: }
681*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} [[S4_CTOR]]([[S4]]* {{.*}},
682*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}void [[ST_S4_ST_DTOR]](i8*)
683*0a6a1f1dSLionel Sambuc // CHECK: store i8* %0, i8** [[ARG_ADDR:%.*]],
684*0a6a1f1dSLionel Sambuc // CHECK: [[ARG:%.+]] = load i8** [[ARG_ADDR]]
685*0a6a1f1dSLionel Sambuc // CHECK: [[RES:%.*]] = bitcast i8* [[ARG]] to [[S4]]*
686*0a6a1f1dSLionel Sambuc // CHECK-NEXT: call {{.*}} [[S4_DTOR:@.+]]([[S4]]* [[RES]])
687*0a6a1f1dSLionel Sambuc // CHECK-NEXT: ret void
688*0a6a1f1dSLionel Sambuc // CHECK-NEXT: }
689*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} [[S4_DTOR]]([[S4]]* {{.*}})
690*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR:%.*]] = alloca [[IDENT]]
691*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: [[KMPC_LOC_ADDR_PSOURCE:%.*]] = getelementptr inbounds [[IDENT]]* [[KMPC_LOC_ADDR]], i{{.*}} 0, i{{.*}} 4
692*0a6a1f1dSLionel Sambuc // CHECK-DEBUG-NEXT: store i8* getelementptr inbounds ([{{.*}} x i8]* [[LOC20]], i{{.*}} 0, i{{.*}} 0), i8** [[KMPC_LOC_ADDR_PSOURCE]]
693*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: @__kmpc_global_thread_num
694*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: call {{.*}}void @__kmpc_threadprivate_register([[IDENT]]* [[KMPC_LOC_ADDR]], i8* bitcast ([[S4]]* [[ST_S4_ST]] to i8*), i8* (i8*)* [[ST_S4_ST_CTOR:@\.__kmpc_global_ctor_\..+]], i8* (i8*, i8*)* null, void (i8*)* [[ST_S4_ST_DTOR:@\.__kmpc_global_dtor_\..+]])
695*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define internal {{.*}}i8* [[ST_S4_ST_CTOR]](i8*)
696*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: }
697*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define {{.*}} [[S4_CTOR:@.*]]([[S4]]* {{.*}},
698*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define internal {{.*}}void [[ST_S4_ST_DTOR]](i8*)
699*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: }
700*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define {{.*}} [[S4_DTOR:@.*]]([[S4]]* {{.*}})
701*0a6a1f1dSLionel Sambuc
702*0a6a1f1dSLionel Sambuc // CHECK: define internal {{.*}}void {{@.*}}()
703*0a6a1f1dSLionel Sambuc // CHECK-DAG: call {{.*}}void [[GS1_INIT]]()
704*0a6a1f1dSLionel Sambuc // CHECK-DAG: call {{.*}}void [[ARR_X_INIT]]()
705*0a6a1f1dSLionel Sambuc // CHECK: ret void
706*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: define internal {{.*}}void {{@.*}}()
707*0a6a1f1dSLionel Sambuc // CHECK-DEBUG: ret void
708