xref: /minix3/external/bsd/llvm/dist/clang/test/OpenMP/parallel_firstprivate_codegen.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s
2*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -std=c++11 -triple %itanium_abi_triple -emit-pch -o %t %s
3*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -fopenmp=libiomp5 -x c++ -triple %itanium_abi_triple -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -std=c++11 -DLAMBDA -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s
5*0a6a1f1dSLionel Sambuc // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -x c++ -fblocks -DBLOCKS -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s
6*0a6a1f1dSLionel Sambuc // expected-no-diagnostics
7*0a6a1f1dSLionel Sambuc #ifndef HEADER
8*0a6a1f1dSLionel Sambuc #define HEADER
9*0a6a1f1dSLionel Sambuc 
10*0a6a1f1dSLionel Sambuc struct St {
11*0a6a1f1dSLionel Sambuc   int a, b;
StSt12*0a6a1f1dSLionel Sambuc   St() : a(0), b(0) {}
StSt13*0a6a1f1dSLionel Sambuc   St(const St &st) : a(st.a + st.b), b(0) {}
~StSt14*0a6a1f1dSLionel Sambuc   ~St() {}
15*0a6a1f1dSLionel Sambuc };
16*0a6a1f1dSLionel Sambuc 
17*0a6a1f1dSLionel Sambuc volatile int g = 1212;
18*0a6a1f1dSLionel Sambuc 
19*0a6a1f1dSLionel Sambuc template <class T>
20*0a6a1f1dSLionel Sambuc struct S {
21*0a6a1f1dSLionel Sambuc   T f;
SS22*0a6a1f1dSLionel Sambuc   S(T a) : f(a + g) {}
SS23*0a6a1f1dSLionel Sambuc   S() : f(g) {}
SS24*0a6a1f1dSLionel Sambuc   S(const S &s, St t = St()) : f(s.f + t.a) {}
operator TS25*0a6a1f1dSLionel Sambuc   operator T() { return T(); }
~SS26*0a6a1f1dSLionel Sambuc   ~S() {}
27*0a6a1f1dSLionel Sambuc };
28*0a6a1f1dSLionel Sambuc 
29*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[S_FLOAT_TY:%.+]] = type { float }
30*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} }
31*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[ST_TY:%.+]] = type { i{{[0-9]+}}, i{{[0-9]+}} }
32*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type { [2 x i{{[0-9]+}}]*, i{{[0-9]+}}*, [2 x [[S_FLOAT_TY]]]*, [[S_FLOAT_TY]]* }
33*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[CAP_TMAIN_TY:%.+]] = type { [2 x i{{[0-9]+}}]*, i{{[0-9]+}}*, [2 x [[S_INT_TY]]]*, [[S_INT_TY]]* }
34*0a6a1f1dSLionel Sambuc // CHECK-DAG: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 66, i32 0, i32 0, i8*
35*0a6a1f1dSLionel Sambuc 
36*0a6a1f1dSLionel Sambuc template <typename T>
tmain()37*0a6a1f1dSLionel Sambuc T tmain() {
38*0a6a1f1dSLionel Sambuc   S<T> test;
39*0a6a1f1dSLionel Sambuc   T t_var = T();
40*0a6a1f1dSLionel Sambuc   T vec[] = {1, 2};
41*0a6a1f1dSLionel Sambuc   S<T> s_arr[] = {1, 2};
42*0a6a1f1dSLionel Sambuc   S<T> var(3);
43*0a6a1f1dSLionel Sambuc #pragma omp parallel firstprivate(t_var, vec, s_arr, var)
44*0a6a1f1dSLionel Sambuc   {
45*0a6a1f1dSLionel Sambuc     vec[0] = t_var;
46*0a6a1f1dSLionel Sambuc     s_arr[0] = var;
47*0a6a1f1dSLionel Sambuc   }
48*0a6a1f1dSLionel Sambuc   return T();
49*0a6a1f1dSLionel Sambuc }
50*0a6a1f1dSLionel Sambuc 
main()51*0a6a1f1dSLionel Sambuc int main() {
52*0a6a1f1dSLionel Sambuc #ifdef LAMBDA
53*0a6a1f1dSLionel Sambuc   // LAMBDA: [[G:@.+]] = global i{{[0-9]+}} 1212,
54*0a6a1f1dSLionel Sambuc   // LAMBDA-LABEL: @main
55*0a6a1f1dSLionel Sambuc   // LAMBDA: call void [[OUTER_LAMBDA:@.+]](
56*0a6a1f1dSLionel Sambuc   [&]() {
57*0a6a1f1dSLionel Sambuc   // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]](
58*0a6a1f1dSLionel Sambuc   // LAMBDA: [[G_LOCAL_REF:%.+]] = getelementptr inbounds %{{.+}}* [[AGG_CAPTURED:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
59*0a6a1f1dSLionel Sambuc   // LAMBDA: store i{{[0-9]+}}* [[G]], i{{[0-9]+}}** [[G_LOCAL_REF]]
60*0a6a1f1dSLionel Sambuc   // LAMBDA: [[ARG:%.+]] = bitcast %{{.+}}* [[AGG_CAPTURED]] to i8*
61*0a6a1f1dSLionel Sambuc   // LAMBDA: call void {{.+}}* @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]])
62*0a6a1f1dSLionel Sambuc #pragma omp parallel firstprivate(g)
63*0a6a1f1dSLionel Sambuc   {
64*0a6a1f1dSLionel Sambuc     // LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]])
65*0a6a1f1dSLionel Sambuc     // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
66*0a6a1f1dSLionel Sambuc     // LAMBDA: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]],
67*0a6a1f1dSLionel Sambuc     // LAMBDA: [[ARG:%.+]] = load %{{.+}}** [[ARG_REF]]
68*0a6a1f1dSLionel Sambuc     // LAMBDA: [[G_REF_ADDR:%.+]] = getelementptr inbounds %{{.+}}* [[ARG]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
69*0a6a1f1dSLionel Sambuc     // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}** [[G_REF_ADDR]]
70*0a6a1f1dSLionel Sambuc     // LAMBDA: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}* [[G_REF]]
71*0a6a1f1dSLionel Sambuc     // LAMBDA: store volatile i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
72*0a6a1f1dSLionel Sambuc     // LAMBDA: call i32 @__kmpc_cancel_barrier(
73*0a6a1f1dSLionel Sambuc     g = 1;
74*0a6a1f1dSLionel Sambuc     // LAMBDA: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]],
75*0a6a1f1dSLionel Sambuc     // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
76*0a6a1f1dSLionel Sambuc     // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]]
77*0a6a1f1dSLionel Sambuc     // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]])
78*0a6a1f1dSLionel Sambuc     [&]() {
79*0a6a1f1dSLionel Sambuc       // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]])
80*0a6a1f1dSLionel Sambuc       // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]],
81*0a6a1f1dSLionel Sambuc       g = 2;
82*0a6a1f1dSLionel Sambuc       // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}** [[ARG_PTR_REF]]
83*0a6a1f1dSLionel Sambuc       // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
84*0a6a1f1dSLionel Sambuc       // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}** [[G_PTR_REF]]
85*0a6a1f1dSLionel Sambuc       // LAMBDA: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]]
86*0a6a1f1dSLionel Sambuc     }();
87*0a6a1f1dSLionel Sambuc   }
88*0a6a1f1dSLionel Sambuc   }();
89*0a6a1f1dSLionel Sambuc   return 0;
90*0a6a1f1dSLionel Sambuc #elif defined(BLOCKS)
91*0a6a1f1dSLionel Sambuc   // BLOCKS: [[G:@.+]] = global i{{[0-9]+}} 1212,
92*0a6a1f1dSLionel Sambuc   // BLOCKS-LABEL: @main
93*0a6a1f1dSLionel Sambuc   // BLOCKS: call void {{%.+}}(i8*
94*0a6a1f1dSLionel Sambuc   ^{
95*0a6a1f1dSLionel Sambuc   // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8*
96*0a6a1f1dSLionel Sambuc   // BLOCKS: [[G_LOCAL_REF:%.+]] = getelementptr inbounds %{{.+}}* [[AGG_CAPTURED:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
97*0a6a1f1dSLionel Sambuc   // BLOCKS: store i{{[0-9]+}}* [[G]], i{{[0-9]+}}** [[G_LOCAL_REF]]
98*0a6a1f1dSLionel Sambuc   // BLOCKS: [[ARG:%.+]] = bitcast %{{.+}}* [[AGG_CAPTURED]] to i8*
99*0a6a1f1dSLionel Sambuc   // BLOCKS: call void {{.+}}* @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}}, i8* [[ARG]])
100*0a6a1f1dSLionel Sambuc #pragma omp parallel firstprivate(g)
101*0a6a1f1dSLionel Sambuc   {
102*0a6a1f1dSLionel Sambuc     // BLOCKS: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* %{{.+}}, i32* %{{.+}}, %{{.+}}* [[ARG:%.+]])
103*0a6a1f1dSLionel Sambuc     // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
104*0a6a1f1dSLionel Sambuc     // BLOCKS: store %{{.+}}* [[ARG]], %{{.+}}** [[ARG_REF:%.+]],
105*0a6a1f1dSLionel Sambuc     // BLOCKS: [[ARG:%.+]] = load %{{.+}}** [[ARG_REF]]
106*0a6a1f1dSLionel Sambuc     // BLOCKS: [[G_REF_ADDR:%.+]] = getelementptr inbounds %{{.+}}* [[ARG]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
107*0a6a1f1dSLionel Sambuc     // BLOCKS: [[G_REF:%.+]] = load i{{[0-9]+}}** [[G_REF_ADDR]]
108*0a6a1f1dSLionel Sambuc     // BLOCKS: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}* [[G_REF]]
109*0a6a1f1dSLionel Sambuc     // BLOCKS: store volatile i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
110*0a6a1f1dSLionel Sambuc     // BLOCKS: call i32 @__kmpc_cancel_barrier(
111*0a6a1f1dSLionel Sambuc     g = 1;
112*0a6a1f1dSLionel Sambuc     // BLOCKS: store volatile i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]],
113*0a6a1f1dSLionel Sambuc     // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
114*0a6a1f1dSLionel Sambuc     // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
115*0a6a1f1dSLionel Sambuc     // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
116*0a6a1f1dSLionel Sambuc     // BLOCKS: call void {{%.+}}(i8*
117*0a6a1f1dSLionel Sambuc     ^{
118*0a6a1f1dSLionel Sambuc       // BLOCKS: define {{.+}} void {{@.+}}(i8*
119*0a6a1f1dSLionel Sambuc       g = 2;
120*0a6a1f1dSLionel Sambuc       // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
121*0a6a1f1dSLionel Sambuc       // BLOCKS: store volatile i{{[0-9]+}} 2, i{{[0-9]+}}*
122*0a6a1f1dSLionel Sambuc       // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
123*0a6a1f1dSLionel Sambuc       // BLOCKS: ret
124*0a6a1f1dSLionel Sambuc     }();
125*0a6a1f1dSLionel Sambuc   }
126*0a6a1f1dSLionel Sambuc   }();
127*0a6a1f1dSLionel Sambuc   return 0;
128*0a6a1f1dSLionel Sambuc #else
129*0a6a1f1dSLionel Sambuc   S<float> test;
130*0a6a1f1dSLionel Sambuc   int t_var = 0;
131*0a6a1f1dSLionel Sambuc   int vec[] = {1, 2};
132*0a6a1f1dSLionel Sambuc   S<float> s_arr[] = {1, 2};
133*0a6a1f1dSLionel Sambuc   S<float> var(3);
134*0a6a1f1dSLionel Sambuc #pragma omp parallel firstprivate(t_var, vec, s_arr, var)
135*0a6a1f1dSLionel Sambuc   {
136*0a6a1f1dSLionel Sambuc     vec[0] = t_var;
137*0a6a1f1dSLionel Sambuc     s_arr[0] = var;
138*0a6a1f1dSLionel Sambuc   }
139*0a6a1f1dSLionel Sambuc   return tmain<int>();
140*0a6a1f1dSLionel Sambuc #endif
141*0a6a1f1dSLionel Sambuc }
142*0a6a1f1dSLionel Sambuc 
143*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}}i{{[0-9]+}} @main()
144*0a6a1f1dSLionel Sambuc // CHECK: [[TEST:%.+]] = alloca [[S_FLOAT_TY]],
145*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[S_FLOAT_TY_DEF_CONSTR:@.+]]([[S_FLOAT_TY]]* [[TEST]])
146*0a6a1f1dSLionel Sambuc // CHECK: %{{.+}} = bitcast [[CAP_MAIN_TY]]*
147*0a6a1f1dSLionel Sambuc // CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...)* @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[CAP_MAIN_TY]]*)* [[MAIN_MICROTASK:@.+]] to void
148*0a6a1f1dSLionel Sambuc // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]()
149*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[S_FLOAT_TY_DESTR:@.+]]([[S_FLOAT_TY]]*
150*0a6a1f1dSLionel Sambuc // CHECK: ret
151*0a6a1f1dSLionel Sambuc //
152*0a6a1f1dSLionel Sambuc // CHECK: define internal void [[MAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, [[CAP_MAIN_TY]]* %{{.+}})
153*0a6a1f1dSLionel Sambuc // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
154*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
155*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_FLOAT_TY]]],
156*0a6a1f1dSLionel Sambuc // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_FLOAT_TY]],
157*0a6a1f1dSLionel Sambuc // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]],
158*0a6a1f1dSLionel Sambuc // CHECK: [[T_VAR_PTR_REF:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 1
159*0a6a1f1dSLionel Sambuc // CHECK: [[T_VAR_REF:%.+]] = load i{{[0-9]+}}** [[T_VAR_PTR_REF]],
160*0a6a1f1dSLionel Sambuc // CHECK: [[T_VAR_VAL:%.+]] = load i{{[0-9]+}}* [[T_VAR_REF]],
161*0a6a1f1dSLionel Sambuc // CHECK: store i{{[0-9]+}} [[T_VAR_VAL]], i{{[0-9]+}}* [[T_VAR_PRIV]],
162*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_PTR_REF:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0
163*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_REF:%.+]] = load [2 x i{{[0-9]+}}]** [[VEC_PTR_REF:%.+]],
164*0a6a1f1dSLionel Sambuc // CHECK: br label %[[VEC_PRIV_INIT:.+]]
165*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_PRIV_INIT]]
166*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_DEST:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8*
167*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_REF]] to i8*
168*0a6a1f1dSLionel Sambuc // CHECK: call void @llvm.memcpy.{{.+}}(i8* [[VEC_DEST]], i8* [[VEC_SRC]],
169*0a6a1f1dSLionel Sambuc // CHECK: br label %[[VEC_PRIV_INIT_END:.+]]
170*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_PRIV_INIT_END]]
171*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_REF_PTR:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 2
172*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_REF:%.+]] = load [2 x [[S_FLOAT_TY]]]** [[S_ARR_REF_PTR]],
173*0a6a1f1dSLionel Sambuc // CHECK: br label %[[S_ARR_PRIV_INIT:.+]]
174*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV_INIT]]
175*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]]* [[S_ARR_REF]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
176*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]]* [[S_ARR_PRIV]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
177*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_END:%.+]] = getelementptr [[S_FLOAT_TY]]* [[S_ARR_BEGIN]], i{{[0-9]+}} 2
178*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2
179*0a6a1f1dSLionel Sambuc // CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]]
180*0a6a1f1dSLionel Sambuc // CHECK: br i1 [[IS_EMPTY]], label %[[S_ARR_BODY_DONE:.+]], label %[[S_ARR_BODY:.+]]
181*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_BODY]]
182*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
183*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[S_FLOAT_TY_COPY_CONSTR:@.+]]([[S_FLOAT_TY]]* {{.+}}, [[S_FLOAT_TY]]* {{.+}}, [[ST_TY]]* [[ST_TY_TEMP]])
184*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[ST_TY_DESTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP]])
185*0a6a1f1dSLionel Sambuc // CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]]
186*0a6a1f1dSLionel Sambuc // CHECK: br label %[[S_ARR_PRIV_INIT_END:.+]]
187*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV_INIT_END]]
188*0a6a1f1dSLionel Sambuc // CHECK: [[VAR_REF_PTR:%.+]] = getelementptr inbounds [[CAP_MAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 3
189*0a6a1f1dSLionel Sambuc // CHECK: [[VAR_REF:%.+]] = load [[S_FLOAT_TY]]** [[VAR_REF_PTR]],
190*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
191*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[S_FLOAT_TY_COPY_CONSTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]], [[S_FLOAT_TY]]* {{.*}} [[VAR_REF]], [[ST_TY]]* [[ST_TY_TEMP]])
192*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]])
193*0a6a1f1dSLionel Sambuc // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}** [[GTID_ADDR_ADDR]]
194*0a6a1f1dSLionel Sambuc // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}* [[GTID_REF]]
195*0a6a1f1dSLionel Sambuc // CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]])
196*0a6a1f1dSLionel Sambuc // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]])
197*0a6a1f1dSLionel Sambuc // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]*
198*0a6a1f1dSLionel Sambuc // CHECK: ret void
199*0a6a1f1dSLionel Sambuc 
200*0a6a1f1dSLionel Sambuc // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]()
201*0a6a1f1dSLionel Sambuc // CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]],
202*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR:@.+]]([[S_INT_TY]]* [[TEST]])
203*0a6a1f1dSLionel Sambuc // CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...)* @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 1, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, [[CAP_TMAIN_TY]]*)* [[TMAIN_MICROTASK:@.+]] to void
204*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[S_INT_TY_DESTR:@.+]]([[S_INT_TY]]*
205*0a6a1f1dSLionel Sambuc // CHECK: ret
206*0a6a1f1dSLionel Sambuc //
207*0a6a1f1dSLionel Sambuc // CHECK: define internal void [[TMAIN_MICROTASK]](i{{[0-9]+}}* [[GTID_ADDR:%.+]], i{{[0-9]+}}* %{{.+}}, [[CAP_TMAIN_TY]]* %{{.+}})
208*0a6a1f1dSLionel Sambuc // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
209*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
210*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_INT_TY]]],
211*0a6a1f1dSLionel Sambuc // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_INT_TY]],
212*0a6a1f1dSLionel Sambuc // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]],
213*0a6a1f1dSLionel Sambuc // CHECK: [[T_VAR_PTR_REF:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 1
214*0a6a1f1dSLionel Sambuc // CHECK: [[T_VAR_REF:%.+]] = load i{{[0-9]+}}** [[T_VAR_PTR_REF]],
215*0a6a1f1dSLionel Sambuc // CHECK: [[T_VAR_VAL:%.+]] = load i{{[0-9]+}}* [[T_VAR_REF]],
216*0a6a1f1dSLionel Sambuc // CHECK: store i{{[0-9]+}} [[T_VAR_VAL]], i{{[0-9]+}}* [[T_VAR_PRIV]],
217*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_PTR_REF:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 0
218*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_REF:%.+]] = load [2 x i{{[0-9]+}}]** [[VEC_PTR_REF:%.+]],
219*0a6a1f1dSLionel Sambuc // CHECK: br label %[[VEC_PRIV_INIT:.+]]
220*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_PRIV_INIT]]
221*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_DEST:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8*
222*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_REF]] to i8*
223*0a6a1f1dSLionel Sambuc // CHECK: call void @llvm.memcpy.{{.+}}(i8* [[VEC_DEST]], i8* [[VEC_SRC]],
224*0a6a1f1dSLionel Sambuc // CHECK: br label %[[VEC_PRIV_INIT_END:.+]]
225*0a6a1f1dSLionel Sambuc // CHECK: [[VEC_PRIV_INIT_END]]
226*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_REF_PTR:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 2
227*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_REF:%.+]] = load [2 x [[S_INT_TY]]]** [[S_ARR_REF_PTR]],
228*0a6a1f1dSLionel Sambuc // CHECK: br label %[[S_ARR_PRIV_INIT:.+]]
229*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV_INIT]]
230*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_INT_TY]]]* [[S_ARR_REF]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
231*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_INT_TY]]]* [[S_ARR_PRIV]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
232*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_END:%.+]] = getelementptr [[S_INT_TY]]* [[S_ARR_BEGIN]], i{{[0-9]+}} 2
233*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2
234*0a6a1f1dSLionel Sambuc // CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]]
235*0a6a1f1dSLionel Sambuc // CHECK: br i1 [[IS_EMPTY]], label %[[S_ARR_BODY_DONE:.+]], label %[[S_ARR_BODY:.+]]
236*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_BODY]]
237*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
238*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[S_INT_TY_COPY_CONSTR:@.+]]([[S_INT_TY]]* {{.+}}, [[S_INT_TY]]* {{.+}}, [[ST_TY]]* [[ST_TY_TEMP]])
239*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]])
240*0a6a1f1dSLionel Sambuc // CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]]
241*0a6a1f1dSLionel Sambuc // CHECK: br label %[[S_ARR_PRIV_INIT_END:.+]]
242*0a6a1f1dSLionel Sambuc // CHECK: [[S_ARR_PRIV_INIT_END]]
243*0a6a1f1dSLionel Sambuc // CHECK: [[VAR_REF_PTR:%.+]] = getelementptr inbounds [[CAP_TMAIN_TY]]* %{{.+}}, i{{[0-9]+}} 0, i{{[0-9]+}} 3
244*0a6a1f1dSLionel Sambuc // CHECK: [[VAR_REF:%.+]] = load [[S_INT_TY]]** [[VAR_REF_PTR]],
245*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
246*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[S_INT_TY_COPY_CONSTR]]([[S_INT_TY]]* [[VAR_PRIV]], [[S_INT_TY]]* {{.*}} [[VAR_REF]], [[ST_TY]]* [[ST_TY_TEMP]])
247*0a6a1f1dSLionel Sambuc // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]])
248*0a6a1f1dSLionel Sambuc // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}** [[GTID_ADDR_ADDR]]
249*0a6a1f1dSLionel Sambuc // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}* [[GTID_REF]]
250*0a6a1f1dSLionel Sambuc // CHECK: call i32 @__kmpc_cancel_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]])
251*0a6a1f1dSLionel Sambuc // CHECK-DAG: call {{.*}} [[S_INT_TY_DESTR]]([[S_INT_TY]]* [[VAR_PRIV]])
252*0a6a1f1dSLionel Sambuc // CHECK-DAG: call {{.*}} [[S_INT_TY_DESTR]]([[S_INT_TY]]*
253*0a6a1f1dSLionel Sambuc // CHECK: ret void
254*0a6a1f1dSLionel Sambuc #endif
255*0a6a1f1dSLionel Sambuc 
256