1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-apple-darwin10 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4 // RUN: %clang_cc1 -verify -fopenmp -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=LAMBDA %s
5 // RUN: %clang_cc1 -verify -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s
6 // expected-no-diagnostics
7 // REQUIRES: x86-registered-target
8 #ifndef HEADER
9 #define HEADER
10 
11 struct St {
12   int a, b;
13   St() : a(0), b(0) {}
14   St(const St &st) : a(st.a + st.b), b(0) {}
15   ~St() {}
16 };
17 
18 volatile int g = 1212;
19 
20 template <class T>
21 struct S {
22   T f;
23   S(T a) : f(a + g) {}
24   S() : f(g) {}
25   S(const S &s, St t = St()) : f(s.f + t.a) {}
26   operator T() { return T(); }
27   ~S() {}
28 };
29 
30 // CHECK-DAG: [[S_FLOAT_TY:%.+]] = type { float }
31 // CHECK-DAG: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} }
32 // CHECK-DAG: [[ST_TY:%.+]] = type { i{{[0-9]+}}, i{{[0-9]+}} }
33 
34 template <typename T>
35 T tmain() {
36   S<T> test;
37   T t_var = T();
38   T vec[] = {1, 2};
39   S<T> s_arr[] = {1, 2};
40   S<T> var(3);
41 #pragma omp parallel
42 #pragma omp sections firstprivate(t_var, vec, s_arr, var)
43   {
44     vec[0] = t_var;
45 #pragma omp section
46     s_arr[0] = var;
47   }
48   return T();
49 }
50 
51 // CHECK: [[TEST:@.+]] = global [[S_FLOAT_TY]] zeroinitializer,
52 S<float> test;
53 // CHECK-DAG: [[T_VAR:@.+]] = global i{{[0-9]+}} 333,
54 int t_var = 333;
55 // CHECK-DAG: [[VEC:@.+]] = global [2 x i{{[0-9]+}}] [i{{[0-9]+}} 1, i{{[0-9]+}} 2],
56 int vec[] = {1, 2};
57 // CHECK-DAG: [[S_ARR:@.+]] = global [2 x [[S_FLOAT_TY]]] zeroinitializer,
58 S<float> s_arr[] = {1, 2};
59 // CHECK-DAG: [[VAR:@.+]] = global [[S_FLOAT_TY]] zeroinitializer,
60 S<float> var(3);
61 // CHECK-DAG: [[SIVAR:@.+]] = internal global i{{[0-9]+}} 0,
62 // CHECK-DAG: [[SECTIONS_BARRIER_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 194, i32 0, i32 0, i8*
63 
64 // CHECK: call {{.*}} [[S_FLOAT_TY_DEF_CONSTR:@.+]]([[S_FLOAT_TY]]* [[TEST]])
65 // CHECK: ([[S_FLOAT_TY]]*)* [[S_FLOAT_TY_DESTR:@[^ ]+]] {{[^,]+}}, {{.+}}([[S_FLOAT_TY]]* [[TEST]]
66 int main() {
67   static int sivar;
68 #ifdef LAMBDA
69   // LAMBDA: [[G:@.+]] = global i{{[0-9]+}} 1212,
70   // LAMBDA-LABEL: @main
71   // LAMBDA: call void [[OUTER_LAMBDA:@.+]](
72   [&]() {
73 // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]](
74 // LAMBDA: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}})
75 #pragma omp parallel
76 #pragma omp sections firstprivate(g, sivar)
77   {
78     // LAMBDA: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* noalias %{{.+}}, i32* noalias %{{.+}}, i32* dereferenceable(4) [[SIVAR_REF:%.+]])
79     // Skip temp vars for loop
80     // LAMBDA: alloca i{{[0-9]+}},
81     // LAMBDA: alloca i{{[0-9]+}},
82     // LAMBDA: alloca i{{[0-9]+}},
83     // LAMBDA: alloca i{{[0-9]+}},
84     // LAMBDA: alloca i{{[0-9]+}},
85 
86     // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
87     // LAMBDA: [[SIVAR1_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
88     // LAMBDA: store i{{[0-9]+}}* [[SIVAR_REF]], i{{[0-9]+}}** [[SIVAR_REF_ADDR:%.+]],
89     // LAMBDA: [[SIVAR1_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[SIVAR_REF_ADDR]],
90     // LAMBDA: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]]
91     // LAMBDA: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
92 
93     // LAMBDA: [[SIVAR1_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIVAR1_REF]]
94     // LAMBDA: store i{{[0-9]+}} [[SIVAR1_VAL]], i{{[0-9]+}}* [[SIVAR1_PRIVATE_ADDR]]
95 
96     // LAMBDA-NOT: call void @__kmpc_barrier(
97     {
98       g = 1;
99       sivar = 10;
100     }
101     // LAMBDA: call void @__kmpc_for_static_init_4(
102     // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]],
103     // LAMBDA: store i{{[0-9]+}} 10, i{{[0-9]+}}* [[SIVAR1_PRIVATE_ADDR]],
104     // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
105     // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]]
106     // LAMBDA: [[SIVAR_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
107     // LAMBDA: store i{{[0-9]+}}* [[SIVAR1_PRIVATE_ADDR]], i{{[0-9]+}}** [[SIVAR_PRIVATE_ADDR_REF]]
108     // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]])
109     // LAMBDA: call void @__kmpc_for_static_fini(
110     // LAMBDA: call void @__kmpc_barrier(
111 #pragma omp section
112     [&]() {
113       // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]])
114       // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]],
115       g = 2;
116       sivar = 20;
117       // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]]
118       // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
119       // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]]
120       // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]]
121       // LAMBDA: [[SIVAR_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
122       // LAMBDA: [[SIVAR_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[SIVAR_PTR_REF]]
123       // LAMBDA: store i{{[0-9]+}} 20, i{{[0-9]+}}* [[SIVAR_REF]]
124     }();
125   }
126   }();
127   return 0;
128 #elif defined(BLOCKS)
129   // BLOCKS: [[G:@.+]] = global i{{[0-9]+}} 1212,
130   // BLOCKS-LABEL: @main
131   // BLOCKS: call void {{%.+}}(i8
132   ^{
133 // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8*
134 // BLOCKS: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}})
135 #pragma omp parallel
136 #pragma omp sections firstprivate(g, sivar)
137    {
138     // BLOCKS: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* noalias %{{.+}}, i32* noalias %{{.+}}, i32* dereferenceable(4) [[SIVAR_REF:%.+]])
139     // Skip temp vars for loop
140     // BLOCKS: alloca i{{[0-9]+}},
141     // BLOCKS: alloca i{{[0-9]+}},
142     // BLOCKS: alloca i{{[0-9]+}},
143     // BLOCKS: alloca i{{[0-9]+}},
144     // BLOCKS: alloca i{{[0-9]+}},
145     // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
146     // BLOCKS: [[SIVAR1_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
147 
148     // BLOCKS: store i{{[0-9]+}}* [[SIVAR_REF]], i{{[0-9]+}}** {{.+}},
149     // BLOCKS: [[SIVAR1_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** {{.+}},
150 
151     // BLOCKS: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]]
152     // BLOCKS: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
153 
154     // BLOCKS: [[SIVAR1_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIVAR1_REF]],
155     // BLOCKS: store i{{[0-9]+}} [[SIVAR1_VAL]], i{{[0-9]+}}* [[SIVAR1_PRIVATE_ADDR]],
156     // BLOCKS-NOT: call void @__kmpc_barrier(
157     {
158       g = 1;
159       sivar = 10;
160     }
161     // BLOCKS: call void @__kmpc_for_static_init_4(
162     // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]],
163     // BLOCKS: store i{{[0-9]+}} 10, i{{[0-9]+}}* [[SIVAR1_PRIVATE_ADDR]],
164     // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
165     // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
166     // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
167     // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
168     // BLOCKS: i{{[0-9]+}}* [[SIVAR1_PRIVATE_ADDR]]
169     // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
170     // BLOCKS: call void {{%.+}}(i8
171     // BLOCKS: call void @__kmpc_for_static_fini(
172     // BLOCKS: call void @__kmpc_barrier(
173 #pragma omp section
174     ^{
175       // BLOCKS: define {{.+}} void {{@.+}}(i8*
176       g = 2;
177       sivar = 20;
178       // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
179       // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}*
180       // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
181       // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
182       // BLOCKS: store i{{[0-9]+}} 20, i{{[0-9]+}}*
183       // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
184       // BLOCKS: ret
185     }();
186   }
187   }();
188   return 0;
189 #else
190 #pragma omp sections firstprivate(t_var, vec, s_arr, var, sivar) nowait
191   {
192     {
193     vec[0] = t_var;
194     s_arr[0] = var;
195     sivar = 31;
196     }
197   }
198   return tmain<int>();
199 #endif
200 }
201 
202 // CHECK: define {{.*}}i{{[0-9]+}} @main()
203 // CHECK: alloca i{{[0-9]+}},
204 // CHECK: alloca i{{[0-9]+}},
205 // CHECK: alloca i{{[0-9]+}},
206 // CHECK: alloca i{{[0-9]+}},
207 // CHECK: alloca i{{[0-9]+}},
208 // CHECK: alloca i{{[0-9]+}},
209 // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
210 // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
211 // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_FLOAT_TY]]],
212 // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_FLOAT_TY]],
213 // CHECK: [[SIVAR_PRIV:%.+]] = alloca i{{[0-9]+}},
214 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(
215 
216 // firstprivate t_var(t_var)
217 // CHECK: [[T_VAR_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[T_VAR]],
218 // CHECK: store i{{[0-9]+}} [[T_VAR_VAL]], i{{[0-9]+}}* [[T_VAR_PRIV]],
219 
220 // firstprivate vec(vec)
221 // CHECK: [[VEC_DEST:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8*
222 // CHECK: call void @llvm.memcpy.{{.+}}(i8* [[VEC_DEST]], i8* bitcast ([2 x i{{[0-9]+}}]* [[VEC]] to i8*),
223 
224 // firstprivate s_arr(s_arr)
225 // CHECK: [[S_ARR_PRIV_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[S_ARR_PRIV]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
226 // CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_FLOAT_TY]], [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2
227 // CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]]
228 // CHECK: br i1 [[IS_EMPTY]], label %[[S_ARR_BODY_DONE:.+]], label %[[S_ARR_BODY:.+]]
229 // CHECK: [[S_ARR_BODY]]
230 // CHECK: getelementptr inbounds ([2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[S_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0)
231 // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
232 // CHECK: call {{.*}} [[S_FLOAT_TY_COPY_CONSTR:@.+]]([[S_FLOAT_TY]]* {{.+}}, [[S_FLOAT_TY]]* {{.+}}, [[ST_TY]]* [[ST_TY_TEMP]])
233 // CHECK: call {{.*}} [[ST_TY_DESTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP]])
234 // CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]]
235 
236 // firstprivate var(var)
237 // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
238 // CHECK: call {{.*}} [[S_FLOAT_TY_COPY_CONSTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]], [[S_FLOAT_TY]]* {{.*}} [[VAR]], [[ST_TY]]* [[ST_TY_TEMP]])
239 // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]])
240 
241 // firstprivate isvar
242 // CHECK: [[SIVAR_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIVAR]],
243 // CHECK: store i{{[0-9]+}} [[SIVAR_VAL]], i{{[0-9]+}}* [[SIVAR_PRIV]],
244 
245 // CHECK-NOT: call void @__kmpc_barrier(
246 // CHECK: call void @__kmpc_for_static_init_4(
247 // CHECK: call void @__kmpc_for_static_fini(
248 
249 // ~(firstprivate var), ~(firstprivate s_arr)
250 // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]])
251 // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]*
252 
253 // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]()
254 
255 // CHECK: ret void
256 
257 // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]()
258 // CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]],
259 // CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR:@.+]]([[S_INT_TY]]* [[TEST]])
260 // CHECK: [[T_VARVAL:%.+]] = load i32, i32* %{{.+}},
261 // CHECK: [[T_VARCONV:%.+]] = bitcast i64* [[T_VARCAST:%.+]] to i32*
262 // CHECK: store i32  [[T_VARVAL]], i32* [[T_VARCONV]],
263 // CHECK: [[T_VARPVT:%.+]] = load i64, i64* [[T_VARCAST]],
264 // CHECK: call void (%{{.+}}*, i{{[0-9]+}}, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)*, ...) @__kmpc_fork_call(%{{.+}}* @{{.+}}, i{{[0-9]+}} 4, void (i{{[0-9]+}}*, i{{[0-9]+}}*, ...)* bitcast (void (i{{[0-9]+}}*, i{{[0-9]+}}*, i64, [2 x i32]*, [2 x [[S_INT_TY]]]*, [[S_INT_TY]]*)* [[TMAIN_MICROTASK:@.+]] to void {{.*}}i64 [[T_VARPVT]],
265 // CHECK: call {{.*}} [[S_INT_TY_DESTR:@.+]]([[S_INT_TY]]*
266 // CHECK: ret
267 //
268 // CHECK: define internal void [[TMAIN_MICROTASK]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}},
269 // Skip temp vars for loop
270 // CHECK: alloca i{{[0-9]+}},
271 // CHECK: alloca i{{[0-9]+}},
272 // CHECK: alloca i{{[0-9]+}},
273 // CHECK: alloca i{{[0-9]+}},
274 // CHECK: alloca i{{[0-9]+}},
275 // CHECK: alloca i{{[0-9]+}},
276 // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
277 // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
278 // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_INT_TY]]],
279 // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_INT_TY]],
280 // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]],
281 
282 // CHECK-NOT: load i{{[0-9]+}}*, i{{[0-9]+}}** %
283 // CHECK: [[VEC_REF:%.+]] = load [2 x i{{[0-9]+}}]*, [2 x i{{[0-9]+}}]** %
284 // CHECK: [[S_ARR:%.+]] = load [2 x [[S_INT_TY]]]*, [2 x [[S_INT_TY]]]** %
285 // CHECK: [[VAR_REF:%.+]] = load [[S_INT_TY]]*, [[S_INT_TY]]** %
286 
287 // firstprivate t_var(t_var)
288 // CHECK: [[T_VAR_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}*
289 // CHECK: store i{{[0-9]+}} [[T_VAR_VAL]], i{{[0-9]+}}* [[T_VAR_PRIV]],
290 
291 // firstprivate vec(vec)
292 // CHECK: [[VEC_DEST:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8*
293 // CHECK: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_REF]] to i8*
294 // CHECK: call void @llvm.memcpy.{{.+}}(i8* [[VEC_DEST]], i8* [[VEC_SRC]],
295 
296 // firstprivate s_arr(s_arr)
297 // CHECK: [[S_ARR_PRIV_BEGIN:%.+]] = getelementptr inbounds [2 x [[S_INT_TY]]], [2 x [[S_INT_TY]]]* [[S_ARR_PRIV]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
298 // CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_INT_TY]], [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2
299 // CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]]
300 // CHECK: br i1 [[IS_EMPTY]], label %[[S_ARR_BODY_DONE:.+]], label %[[S_ARR_BODY:.+]]
301 // CHECK: [[S_ARR_BODY]]
302 // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
303 // CHECK: call {{.*}} [[S_INT_TY_COPY_CONSTR:@.+]]([[S_INT_TY]]* {{.+}}, [[S_INT_TY]]* {{.+}}, [[ST_TY]]* [[ST_TY_TEMP]])
304 // CHECK: call {{.*}} [[ST_TY_DESTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP]])
305 // CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]]
306 
307 // firstprivate var(var)
308 // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
309 // CHECK: call {{.*}} [[S_INT_TY_COPY_CONSTR]]([[S_INT_TY]]* [[VAR_PRIV]], [[S_INT_TY]]* {{.*}} [[VAR_REF]], [[ST_TY]]* [[ST_TY_TEMP]])
310 // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]])
311 
312 // No synchronization for initialization.
313 // CHECK-NOT: call void @__kmpc_barrier(
314 
315 // CHECK: call void @__kmpc_for_static_init_4(
316 // CHECK: call void @__kmpc_for_static_fini(
317 
318 // ~(firstprivate var), ~(firstprivate s_arr)
319 // CHECK-DAG: call {{.*}} [[S_INT_TY_DESTR]]([[S_INT_TY]]* [[VAR_PRIV]])
320 // CHECK-DAG: call {{.*}} [[S_INT_TY_DESTR]]([[S_INT_TY]]*
321 // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_ADDR]]
322 // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]]
323 // CHECK: call void @__kmpc_barrier(%{{.+}}* [[SECTIONS_BARRIER_LOC]], i{{[0-9]+}} [[GTID]])
324 // CHECK: ret void
325 #endif
326 
327