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