• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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;
StSt13   St() : a(0), b(0) {}
StSt14   St(const St &st) : a(st.a + st.b), b(0) {}
~StSt15   ~St() {}
16 };
17 
18 volatile int g = 1212;
19 volatile int &g1 = g;
20 
21 template <class T>
22 struct S {
23   T f;
SS24   S(T a) : f(a + g) {}
SS25   S() : f(g) {}
SS26   S(const S &s, St t = St()) : f(s.f + t.a) {}
operator TS27   operator T() { return T(); }
~SS28   ~S() {}
29 };
30 
31 // CHECK-DAG: [[S_FLOAT_TY:%.+]] = type { float }
32 // CHECK-DAG: [[S_INT_TY:%.+]] = type { i{{[0-9]+}} }
33 // CHECK-DAG: [[ST_TY:%.+]] = type { i{{[0-9]+}}, i{{[0-9]+}} }
34 
35 template <typename T>
tmain()36 T tmain() {
37   S<T> test;
38   T t_var = T();
39   T vec[] = {1, 2};
40   S<T> s_arr[] = {1, 2};
41   S<T> &var = test;
42 #pragma omp parallel
43 #pragma omp for firstprivate(t_var, vec, s_arr, var)
44   for (int i = 0; i < 2; ++i) {
45     vec[i] = t_var;
46     s_arr[i] = 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: [[SIVAR:@.+]] = internal global i{{[0-9]+}} 0,
62 // CHECK-DAG: [[IMPLICIT_BARRIER_LOC:@.+]] = private unnamed_addr constant %{{.+}} { i32 0, i32 66, 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]]
main()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 for firstprivate(g, g1, sivar)
77   for (int i = 0; i < 2; ++i) {
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     // LAMBDA: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
86     // LAMBDA: [[G1_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
87     // LAMBDA: [[SIVAR2_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
88 
89     // LAMBDA:  store i{{[0-9]+}}* [[SIVAR_REF]], i{{[0-9]+}}** %{{.+}},
90     // LAMBDA:  [[SIVAR2_PRIVATE_ADDR_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** %{{.+}},
91 
92 
93     // LAMBDA: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]]
94     // LAMBDA: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
95     // LAMBDA: [[SIVAR2_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIVAR2_PRIVATE_ADDR_REF]]
96     // LAMBDA: store i{{[0-9]+}} [[SIVAR2_VAL]], i{{[0-9]+}}* [[SIVAR2_PRIVATE_ADDR]]
97 
98     // LAMBDA-NOT: call void @__kmpc_barrier(
99     g = 1;
100     g1 = 1;
101     sivar = 2;
102     // LAMBDA: call void @__kmpc_for_static_init_4(
103 
104     // LAMBDA: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]],
105     // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[SIVAR2_PRIVATE_ADDR]],
106     // LAMBDA: [[G_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
107     // LAMBDA: store i{{[0-9]+}}* [[G_PRIVATE_ADDR]], i{{[0-9]+}}** [[G_PRIVATE_ADDR_REF]]
108     // LAMBDA: [[SIVAR_PRIVATE_ADDR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
109     // LAMBDA: store i{{[0-9]+}}* [[SIVAR2_PRIVATE_ADDR]], i{{[0-9]+}}** [[SIVAR_PRIVATE_ADDR_REF]]
110     // LAMBDA: call void [[INNER_LAMBDA:@.+]](%{{.+}}* [[ARG]])
111     // LAMBDA: call void @__kmpc_for_static_fini(
112     // LAMBDA: call void @__kmpc_barrier(
113     [&]() {
114       // LAMBDA: define {{.+}} void [[INNER_LAMBDA]](%{{.+}}* [[ARG_PTR:%.+]])
115       // LAMBDA: store %{{.+}}* [[ARG_PTR]], %{{.+}}** [[ARG_PTR_REF:%.+]],
116       g = 2;
117       g1 = 2;
118       sivar = 4;
119       // LAMBDA: [[ARG_PTR:%.+]] = load %{{.+}}*, %{{.+}}** [[ARG_PTR_REF]]
120 
121       // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
122       // LAMBDA: [[G_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[G_PTR_REF]]
123       // LAMBDA: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[G_REF]]
124       // LAMBDA: [[SIVAR_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, %{{.+}}* [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
125       // LAMBDA: [[SIVAR_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[SIVAR_PTR_REF]]
126       // LAMBDA: store i{{[0-9]+}} 4, i{{[0-9]+}}* [[SIVAR_REF]]
127     }();
128   }
129   }();
130   return 0;
131 #elif defined(BLOCKS)
132   // BLOCKS: [[G:@.+]] = global i{{[0-9]+}} 1212,
133   // BLOCKS-LABEL: @main
134   // BLOCKS: call void {{%.+}}(i8
135   ^{
136 // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(i8*
137 // BLOCKS: call void {{.+}} @__kmpc_fork_call({{.+}}, i32 1, {{.+}}* [[OMP_REGION:@.+]] to {{.+}})
138 #pragma omp parallel
139 #pragma omp for firstprivate(g, g1, sivar)
140   for (int i = 0; i < 2; ++i) {
141     // BLOCKS: define{{.*}} internal{{.*}} void [[OMP_REGION]](i32* noalias %{{.+}}, i32* noalias %{{.+}}, i32* dereferenceable(4) [[SIVAR_REF:%.+]])
142     // Skip temp vars for loop
143     // BLOCKS: alloca i{{[0-9]+}},
144     // BLOCKS: alloca i{{[0-9]+}},
145     // BLOCKS: alloca i{{[0-9]+}},
146     // BLOCKS: alloca i{{[0-9]+}},
147     // BLOCKS: alloca i{{[0-9]+}},
148     // BLOCKS: [[G_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
149     // BLOCKS: [[G1_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
150     // BLOCKS: [[SIVAR2_PRIVATE_ADDR:%.+]] = alloca i{{[0-9]+}},
151 
152     // BLOCKS: store i{{[0-9]+}}* [[SIVAR_REF]], i{{[0-9]+}}** %{{.+}},
153     // BLOCKS: [[SIVAR_REF_ADDRR:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** %{{.+}},
154 
155     // BLOCKS: [[G_VAL:%.+]] = load volatile i{{[0-9]+}}, i{{[0-9]+}}* [[G]]
156     // BLOCKS: store i{{[0-9]+}} [[G_VAL]], i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
157 
158     // BLOCKS: [[SIVAR2_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIVAR_REF_ADDRR]]
159     // BLOCKS: store i{{[0-9]+}} {{.+}}, i{{[0-9]+}}* [[SIVAR2_PRIVATE_ADDR]]
160 
161     // BLOCKS-NOT: call void @__kmpc_barrier(
162     g = 1;
163     g1 =1;
164     sivar = 2;
165     // BLOCKS: call void @__kmpc_for_static_init_4(
166     // BLOCKS: store i{{[0-9]+}} 1, i{{[0-9]+}}* [[G_PRIVATE_ADDR]],
167     // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
168     // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}* [[SIVAR2_PRIVATE_ADDR]],
169     // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
170     // BLOCKS: i{{[0-9]+}}* [[G_PRIVATE_ADDR]]
171     // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
172     // BLOCKS: i{{[0-9]+}}* [[SIVAR2_PRIVATE_ADDR]]
173     // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
174     // BLOCKS: call void {{%.+}}(i8
175     // BLOCKS: call void @__kmpc_for_static_fini(
176     // BLOCKS: call void @__kmpc_barrier(
177     ^{
178       // BLOCKS: define {{.+}} void {{@.+}}(i8*
179       g = 2;
180       g1 = 2;
181       sivar = 4;
182       // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
183       // BLOCKS: store i{{[0-9]+}} 2, i{{[0-9]+}}*
184       // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
185       // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
186       // BLOCKS: store i{{[0-9]+}} 4, i{{[0-9]+}}*
187       // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
188       // BLOCKS: ret
189     }();
190   }
191   }();
192   return 0;
193 #else
194 #pragma omp for firstprivate(t_var, vec, s_arr, var, sivar)
195   for (int i = 0; i < 2; ++i) {
196     vec[i] = t_var;
197     s_arr[i] = var;
198     sivar += i;
199   }
200   return tmain<int>();
201 #endif
202 }
203 
204 // CHECK: define {{.*}}i{{[0-9]+}} @main()
205 // CHECK: alloca i{{[0-9]+}},
206 // Skip temp vars for loop
207 // CHECK: alloca i{{[0-9]+}},
208 // CHECK: alloca i{{[0-9]+}},
209 // CHECK: alloca i{{[0-9]+}},
210 // CHECK: alloca i{{[0-9]+}},
211 // CHECK: alloca i{{[0-9]+}},
212 // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
213 // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
214 // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_FLOAT_TY]]],
215 // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_FLOAT_TY]],
216 // CHECK: [[SIVAR_PRIV:%.+]] = alloca i{{[0-9]+}},
217 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(
218 
219 // firstprivate t_var(t_var)
220 // CHECK: [[T_VAR_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[T_VAR]],
221 // CHECK: store i{{[0-9]+}} [[T_VAR_VAL]], i{{[0-9]+}}* [[T_VAR_PRIV]],
222 
223 // firstprivate vec(vec)
224 // CHECK: [[VEC_DEST:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8*
225 // CHECK: call void @llvm.memcpy.{{.+}}(i8* [[VEC_DEST]], i8* bitcast ([2 x i{{[0-9]+}}]* [[VEC]] to i8*),
226 
227 // firstprivate s_arr(s_arr)
228 // 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
229 // CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_FLOAT_TY]], [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2
230 // CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_FLOAT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]]
231 // CHECK: br i1 [[IS_EMPTY]], label %[[S_ARR_BODY_DONE:.+]], label %[[S_ARR_BODY:.+]]
232 // CHECK: [[S_ARR_BODY]]
233 // CHECK: getelementptr inbounds ([2 x [[S_FLOAT_TY]]], [2 x [[S_FLOAT_TY]]]* [[S_ARR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0)
234 // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
235 // CHECK: call {{.*}} [[S_FLOAT_TY_COPY_CONSTR:@.+]]([[S_FLOAT_TY]]* {{.+}}, [[S_FLOAT_TY]]* {{.+}}, [[ST_TY]]* [[ST_TY_TEMP]])
236 // CHECK: call {{.*}} [[ST_TY_DESTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP]])
237 // CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]]
238 
239 // firstprivate var(var)
240 // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
241 // CHECK: call {{.*}} [[S_FLOAT_TY_COPY_CONSTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]], [[S_FLOAT_TY]]* {{.*}} [[VAR]], [[ST_TY]]* [[ST_TY_TEMP]])
242 // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]])
243 
244 // firstprivate (sivar)
245 // CHECK: [[SIVAR_VAL:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[SIVAR]]
246 // CHECK: store i{{[0-9]+}} [[SIVAR_VAL]], i{{[0-9]+}}* [[SIVAR_PRIV]]
247 
248 // Synchronization for initialization.
249 // CHECK-NOT: call void @__kmpc_barrier(
250 
251 // CHECK: call void @__kmpc_for_static_init_4(
252 // CHECK: call void @__kmpc_for_static_fini(
253 
254 // ~(firstprivate var), ~(firstprivate s_arr)
255 // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]* [[VAR_PRIV]])
256 // CHECK-DAG: call {{.*}} [[S_FLOAT_TY_DESTR]]([[S_FLOAT_TY]]*
257 // CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]])
258 
259 // CHECK: = call {{.*}}i{{.+}} [[TMAIN_INT:@.+]]()
260 
261 // CHECK: ret void
262 
263 // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]()
264 // CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]],
265 // CHECK: [[TVAR:%.+]] = alloca i32,
266 // CHECK: [[TVAR_CAST:%.+]] = alloca i64,
267 // CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR:@.+]]([[S_INT_TY]]* [[TEST]])
268 // CHECK: [[TVAR_VAL:%.+]] = load i32, i32* [[TVAR]],
269 // CHECK: [[TVAR_CONV:%.+]] = bitcast i64* [[TVAR_CAST]] to i32*
270 // CHECK: store i32 [[TVAR_VAL]], i32* [[TVAR_CONV]],
271 // CHECK: [[PVT_CASTVAL:%[^,]+]] = load i64, i64* [[TVAR_CAST]],
272 // 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  (i32*, i32*, ...)*), i64 [[PVT_CASTVAL]],
273 // CHECK: call {{.*}} [[S_INT_TY_DESTR:@.+]]([[S_INT_TY]]*
274 // CHECK: ret
275 //
276 // CHECK: define internal void [[TMAIN_MICROTASK]](i{{[0-9]+}}* noalias [[GTID_ADDR:%.+]], i{{[0-9]+}}* noalias %{{.+}}, i64 {{.*}}%{{.+}}, [2 x i32]* dereferenceable(8) %{{.+}}, [2 x [[S_INT_TY]]]* dereferenceable(8) %{{.+}}, [[S_INT_TY]]* dereferenceable(4) %{{.+}})
277 // Skip temp vars for loop
278 // CHECK: [[T_VAR_PRIV:%.+]] = alloca i{{[0-9]+}},
279 // CHECK: alloca i{{[0-9]+}},
280 // CHECK: alloca i{{[0-9]+}},
281 // CHECK: alloca i{{[0-9]+}},
282 // CHECK: alloca i{{[0-9]+}},
283 // CHECK: alloca i{{[0-9]+}},
284 // CHECK: [[VEC_PRIV:%.+]] = alloca [2 x i{{[0-9]+}}],
285 // CHECK: [[S_ARR_PRIV:%.+]] = alloca [2 x [[S_INT_TY]]],
286 // CHECK: [[VAR_PRIV:%.+]] = alloca [[S_INT_TY]],
287 // CHECK: store i{{[0-9]+}}* [[GTID_ADDR]], i{{[0-9]+}}** [[GTID_ADDR_ADDR:%.+]],
288 // CHECK: %{{.+}} = bitcast i64* [[T_VAR_PRIV]] to i32*
289 
290 // CHECK-NOT: load i{{[0-9]+}}*, i{{[0-9]+}}** %
291 // CHECK: [[VEC_REF:%.+]] = load [2 x i{{[0-9]+}}]*, [2 x i{{[0-9]+}}]** %
292 // CHECK: [[S_ARR:%.+]] = load [2 x [[S_INT_TY]]]*, [2 x [[S_INT_TY]]]** %
293 // CHECK: [[VAR:%.+]] = load [[S_INT_TY]]*, [[S_INT_TY]]** %
294 
295 // firstprivate t_var(t_var)
296 // CHECK-NOT: load i{{[0-9]+}}, i{{[0-9]+}}* [[T_VAR_REF]],
297 
298 // firstprivate vec(vec)
299 // CHECK: [[VEC_DEST:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_PRIV]] to i8*
300 // CHECK: [[VEC_SRC:%.+]] = bitcast [2 x i{{[0-9]+}}]* [[VEC_REF]] to i8*
301 // CHECK: call void @llvm.memcpy.{{.+}}(i8* [[VEC_DEST]], i8* [[VEC_SRC]],
302 
303 // firstprivate s_arr(s_arr)
304 // 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
305 // CHECK: [[S_ARR_PRIV_END:%.+]] = getelementptr [[S_INT_TY]], [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], i{{[0-9]+}} 2
306 // CHECK: [[IS_EMPTY:%.+]] = icmp eq [[S_INT_TY]]* [[S_ARR_PRIV_BEGIN]], [[S_ARR_PRIV_END]]
307 // CHECK: br i1 [[IS_EMPTY]], label %[[S_ARR_BODY_DONE:.+]], label %[[S_ARR_BODY:.+]]
308 // CHECK: [[S_ARR_BODY]]
309 // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
310 // CHECK: call {{.*}} [[S_INT_TY_COPY_CONSTR:@.+]]([[S_INT_TY]]* {{.+}}, [[S_INT_TY]]* {{.+}}, [[ST_TY]]* [[ST_TY_TEMP]])
311 // CHECK: call {{.*}} [[ST_TY_DESTR:@.+]]([[ST_TY]]* [[ST_TY_TEMP]])
312 // CHECK: br i1 {{.+}}, label %{{.+}}, label %[[S_ARR_BODY]]
313 
314 // firstprivate var(var)
315 // CHECK: [[VAR_REF:%.+]] = load [[S_INT_TY]]*, [[S_INT_TY]]** %
316 // CHECK: call {{.*}} [[ST_TY_DEFAULT_CONSTR]]([[ST_TY]]* [[ST_TY_TEMP:%.+]])
317 // CHECK: call {{.*}} [[S_INT_TY_COPY_CONSTR]]([[S_INT_TY]]* [[VAR_PRIV]], [[S_INT_TY]]* {{.*}} [[VAR_REF]], [[ST_TY]]* [[ST_TY_TEMP]])
318 // CHECK: call {{.*}} [[ST_TY_DESTR]]([[ST_TY]]* [[ST_TY_TEMP]])
319 
320 // No synchronization for initialization.
321 // CHECK-NOT: call void @__kmpc_barrier(
322 
323 // CHECK: call void @__kmpc_for_static_init_4(
324 // CHECK: call void @__kmpc_for_static_fini(
325 
326 // ~(firstprivate var), ~(firstprivate s_arr)
327 // CHECK-DAG: call {{.*}} [[S_INT_TY_DESTR]]([[S_INT_TY]]* [[VAR_PRIV]])
328 // CHECK-DAG: call {{.*}} [[S_INT_TY_DESTR]]([[S_INT_TY]]*
329 // CHECK: [[GTID_REF:%.+]] = load i{{[0-9]+}}*, i{{[0-9]+}}** [[GTID_ADDR_ADDR]]
330 // CHECK: [[GTID:%.+]] = load i{{[0-9]+}}, i{{[0-9]+}}* [[GTID_REF]]
331 // CHECK: call void @__kmpc_barrier(%{{.+}}* [[IMPLICIT_BARRIER_LOC]], i{{[0-9]+}} [[GTID]])
332 // CHECK: ret void
333 #endif
334 
335