1 // RUN: %clang_cc1 -verify -Wno-vla -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 -Wno-vla %s -emit-llvm -o - | FileCheck %s
4 // RUN: %clang_cc1 -verify -Wno-vla -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 -Wno-vla -fopenmp -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=BLOCKS %s
6 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck -check-prefix=ARRAY %s
8 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
9 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-apple-darwin10 -emit-pch -o %t %s
10 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-apple-darwin10 -std=c++11 -include-pch %t -verify -Wno-vla %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
11 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -std=c++11 -DLAMBDA -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
12 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -fblocks -DBLOCKS -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
13 // RUN: %clang_cc1 -verify -Wno-vla -fopenmp-simd -x c++ -std=c++11 -DARRAY -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
14 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
15 // expected-no-diagnostics
26 operator T() { return T(); }
32 // CHECK-DAG: [[KMP_TASK_T_TY:%.+]] = type { ptr, ptr, i32, %union{{.+}}, %union{{.+}} }
33 // CHECK-DAG: [[S_DOUBLE_TY:%.+]] = type { double }
34 // CHECK-DAG: [[CAP_MAIN_TY:%.+]] = type { i8 }
35 // CHECK-DAG: [[PRIVATES_MAIN_TY:%.+]] = type {{.?}}{ [2 x [[S_DOUBLE_TY]]], [[S_DOUBLE_TY]], i32, [2 x i32]
36 // CHECK-DAG: [[KMP_TASK_MAIN_TY:%.+]] = type { [[KMP_TASK_T_TY]], [[PRIVATES_MAIN_TY]] }
37 // CHECK-DAG: [[S_INT_TY:%.+]] = type { i32 }
38 // CHECK-DAG: [[CAP_TMAIN_TY:%.+]] = type { i8 }
39 // CHECK-DAG: [[PRIVATES_TMAIN_TY:%.+]] = type { i32, [2 x i32], [2 x [[S_INT_TY]]], [[S_INT_TY]], [104 x i8] }
40 // CHECK-DAG: [[KMP_TASK_TMAIN_TY:%.+]] = type { [[KMP_TASK_T_TY]], [{{[0-9]+}} x i8], [[PRIVATES_TMAIN_TY]] }
44 T t_var
__attribute__((aligned(128))) = T();
46 S
<T
> s_arr
[] = {1, 2};
48 #pragma omp task private(t_var, vec, s_arr, s_arr, var, var)
59 // LAMBDA: [[G:@.+]] ={{.*}} global double
60 // LAMBDA-LABEL: @main
61 // LAMBDA: call{{( x86_thiscallcc)?}} void [[OUTER_LAMBDA:@.+]](
63 // LAMBDA: define{{.*}} internal{{.*}} void [[OUTER_LAMBDA]](
64 // LAMBDA: [[RES:%.+]] = call ptr @__kmpc_omp_task_alloc(ptr @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 56, i64 1, ptr [[TASK_ENTRY:@.+]])
65 // LAMBDA: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i{{.+}} 0, i{{.+}} 1
66 // LAMBDA: call i32 @__kmpc_omp_task(ptr @{{.+}}, i32 %{{.+}}, ptr [[RES]])
68 #pragma omp task private(g, sivar)
70 // LAMBDA: define {{.+}} void [[INNER_LAMBDA:@.+]]({{.+}} [[ARG_PTR:%.+]])
71 // LAMBDA: store ptr [[ARG_PTR]], ptr [[ARG_PTR_REF:%.+]],
72 // LAMBDA: [[ARG_PTR:%.+]] = load ptr, ptr [[ARG_PTR_REF]]
73 // LAMBDA: [[G_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, ptr [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
74 // LAMBDA: [[G_REF:%.+]] = load ptr, ptr [[G_PTR_REF]]
75 // LAMBDA: store double 2.0{{.+}}, ptr [[G_REF]]
76 // LAMBDA: [[SIVAR_PTR_REF:%.+]] = getelementptr inbounds %{{.+}}, ptr [[ARG_PTR]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
77 // LAMBDA: [[SIVAR_REF:%.+]] = load ptr, ptr [[SIVAR_PTR_REF]]
78 // LAMBDA: store i{{[0-9]+}} 3, ptr [[SIVAR_REF]]
80 // LAMBDA: define internal noundef i32 [[TASK_ENTRY]](i32 noundef %0, ptr noalias noundef %1)
83 // LAMBDA: store double 1.0{{.+}}, ptr %{{.+}},
84 // LAMBDA: store i{{[0-9]+}} 2, ptr %{{.+}},
85 // LAMBDA: call void [[INNER_LAMBDA]]({{.+}}
95 // BLOCKS: [[G:@.+]] ={{.*}} global double
96 // BLOCKS: [[SIVAR:@.+]] = internal global i{{[0-9]+}} 0,
97 // BLOCKS-LABEL: @main
98 // BLOCKS: call void {{%.+}}(ptr
100 // BLOCKS: define{{.*}} internal{{.*}} void {{.+}}(ptr
101 // BLOCKS: [[RES:%.+]] = call ptr @__kmpc_omp_task_alloc(ptr @{{[^,]+}}, i32 %{{[^,]+}}, i32 1, i64 56, i64 1, ptr [[TASK_ENTRY:@.+]])
102 // BLOCKS: [[PRIVATES:%.+]] = getelementptr inbounds %{{.+}}, ptr %{{.+}}, i{{.+}} 0, i{{.+}} 1
103 // BLOCKS: call i32 @__kmpc_omp_task(ptr @{{.+}}, i32 %{{.+}}, ptr [[RES]])
105 #pragma omp task private(g, sivar)
107 // BLOCKS: define {{.+}} void {{@.+}}(ptr
108 // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
109 // BLOCKS: store double 2.0{{.+}}, ptr
110 // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
111 // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
112 // BLOCKS: store i{{[0-9]+}} 4, ptr
113 // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
116 // BLOCKS: define internal noundef i32 [[TASK_ENTRY]](i32 noundef %0, ptr noalias noundef %1)
119 // BLOCKS: store double 1.0{{.+}}, ptr %{{.+}},
120 // BLOCKS-NOT: [[G]]{{[[^:word:]]}}
121 // BLOCKS: store i{{[0-9]+}} 3, ptr %{{.+}},
122 // BLOCKS-NOT: [[SIVAR]]{{[[^:word:]]}}
123 // BLOCKS: call void {{%.+}}(ptr
135 S
<double> s_arr
[] = {1, 2};
137 #pragma omp task private(var, t_var, s_arr, vec, s_arr, var, sivar)
149 // CHECK: define{{.*}} i{{[0-9]+}} @main()
150 // CHECK: [[TEST:%.+]] = alloca [[S_DOUBLE_TY]],
151 // CHECK: [[T_VAR_ADDR:%.+]] = alloca i32,
152 // CHECK: [[VEC_ADDR:%.+]] = alloca [2 x i32],
153 // CHECK: [[S_ARR_ADDR:%.+]] = alloca [2 x [[S_DOUBLE_TY]]],
154 // CHECK: [[VAR_ADDR:%.+]] = alloca [[S_DOUBLE_TY]],
155 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(ptr [[LOC:@.+]])
157 // CHECK: call {{.*}} [[S_DOUBLE_TY_DEF_CONSTR:@.+]](ptr {{[^,]*}} [[TEST]])
159 // Do not store original variables in capture struct.
160 // CHECK-NOT: getelementptr inbounds [[CAP_MAIN_TY]],
163 // Returns struct kmp_task_t {
164 // [[KMP_TASK_T_TY]] task_data;
165 // [[KMP_TASK_MAIN_TY]] privates;
167 // CHECK: [[RES:%.+]] = call ptr @__kmpc_omp_task_alloc(ptr [[LOC]], i32 [[GTID]], i32 9, i64 80, i64 1, ptr [[TASK_ENTRY:@[^ ]+]])
169 // CHECK: [[TASK:%.+]] = getelementptr inbounds [[KMP_TASK_MAIN_TY]], ptr [[RES]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
170 // Initialize kmp_task_t->privates with default values (no init for simple types, default constructors for classes).
171 // Also copy address of private copy to the corresponding shareds reference.
172 // CHECK: [[PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_MAIN_TY]], ptr [[RES]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
174 // Constructors for s_arr and var.
176 // CHECK: [[PRIVATE_S_ARR_REF:%.+]] = getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
177 // CHECK: getelementptr inbounds [2 x [[S_DOUBLE_TY]]], ptr [[PRIVATE_S_ARR_REF]], i{{.+}} 0, i{{.+}} 0
178 // CHECK: getelementptr inbounds [[S_DOUBLE_TY]], ptr %{{.+}}, i{{.+}} 2
179 // CHECK: call void [[S_DOUBLE_TY_DEF_CONSTR]](ptr {{[^,]*}} [[S_ARR_CUR:%.+]])
180 // CHECK: getelementptr inbounds [[S_DOUBLE_TY]], ptr [[S_ARR_CUR]], i{{.+}} 1
185 // CHECK: [[PRIVATE_VAR_REF:%.+]] = getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 1
186 // CHECK: call void [[S_DOUBLE_TY_DEF_CONSTR]](ptr {{[^,]*}} [[PRIVATE_VAR_REF:%.+]])
188 // Provide pointer to destructor function, which will destroy private variables at the end of the task.
189 // CHECK: [[DESTRUCTORS_REF:%.+]] = getelementptr inbounds [[KMP_TASK_T_TY]], ptr [[TASK]], i{{.+}} 0, i{{.+}} 3
190 // CHECK: store ptr [[DESTRUCTORS:@.+]], ptr [[DESTRUCTORS_REF]],
193 // CHECK: call i32 @__kmpc_omp_task(ptr [[LOC]], i32 [[GTID]], ptr [[RES]])
194 // CHECK: call i32 @__kmpc_omp_task(ptr [[LOC]], i32 [[GTID]], ptr
196 // CHECK: = call noundef i{{.+}} [[TMAIN_INT:@.+]]()
198 // No destructors must be called for private copies of s_arr and var.
199 // CHECK-NOT: getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 2
200 // CHECK-NOT: getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 3
201 // CHECK: call void [[S_DOUBLE_TY_DESTR:@.+]](ptr
202 // CHECK-NOT: getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 2
203 // CHECK-NOT: getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 3
207 // CHECK: define internal void [[PRIVATES_MAP_FN:@.+]](ptr noalias noundef %0, ptr noalias noundef %1, ptr noalias noundef %2, ptr noalias noundef %3, ptr noalias noundef %4, ptr noalias noundef %5)
208 // CHECK: [[PRIVATES:%.+]] = load ptr, ptr
209 // CHECK: [[PRIV_S_VAR:%.+]] = getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i32 0, i32 0
210 // CHECK: [[ARG3:%.+]] = load ptr, ptr %{{.+}},
211 // CHECK: store ptr [[PRIV_S_VAR]], ptr [[ARG3]],
212 // CHECK: [[PRIV_VAR:%.+]] = getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i32 0, i32 1
213 // CHECK: [[ARG1:%.+]] = load ptr, ptr {{.+}},
214 // CHECK: store ptr [[PRIV_VAR]], ptr [[ARG1]],
215 // CHECK: [[PRIV_T_VAR:%.+]] = getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i32 0, i32 2
216 // CHECK: [[ARG2:%.+]] = load ptr, ptr %{{.+}},
217 // CHECK: store ptr [[PRIV_T_VAR]], ptr [[ARG2]],
218 // CHECK: [[PRIV_VEC:%.+]] = getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i32 0, i32 3
219 // CHECK: [[ARG4:%.+]] = load ptr, ptr %{{.+}},
220 // CHECK: store ptr [[PRIV_VEC]], ptr [[ARG4]],
223 // CHECK: define internal noundef i32 [[TASK_ENTRY]](i32 noundef %0, ptr noalias noundef %1)
226 // CHECK: [[PRIV_VAR_ADDR:%.+]] = alloca ptr,
227 // CHECK: [[PRIV_T_VAR_ADDR:%.+]] = alloca ptr,
228 // CHECK: [[PRIV_S_ARR_ADDR:%.+]] = alloca ptr,
229 // CHECK: [[PRIV_VEC_ADDR:%.+]] = alloca ptr,
230 // CHECK: [[PRIV_SIVAR_ADDR:%.+]] = alloca ptr,
231 // CHECK: store ptr [[PRIVATES_MAP_FN]], ptr [[MAP_FN_ADDR:%.+]],
232 // CHECK: [[MAP_FN:%.+]] = load ptr, ptr [[MAP_FN_ADDR]],
233 // CHECK: call void [[MAP_FN]](ptr %{{.+}}, ptr [[PRIV_VAR_ADDR]], ptr [[PRIV_T_VAR_ADDR]], ptr [[PRIV_S_ARR_ADDR]], ptr [[PRIV_VEC_ADDR]], ptr [[PRIV_SIVAR_ADDR]])
234 // CHECK: [[PRIV_VAR:%.+]] = load ptr, ptr [[PRIV_VAR_ADDR]],
235 // CHECK: [[PRIV_T_VAR:%.+]] = load ptr, ptr [[PRIV_T_VAR_ADDR]],
236 // CHECK: [[PRIV_S_ARR:%.+]] = load ptr, ptr [[PRIV_S_ARR_ADDR]],
237 // CHECK: [[PRIV_VEC:%.+]] = load ptr, ptr [[PRIV_VEC_ADDR]],
238 // CHECK: [[PRIV_SIVAR:%.+]] = load ptr, ptr [[PRIV_SIVAR_ADDR]],
240 // Privates actually are used.
241 // CHECK-DAG: [[PRIV_VAR]]
242 // CHECK-DAG: [[PRIV_T_VAR]]
243 // CHECK-DAG: [[PRIV_S_ARR]]
244 // CHECK-DAG: [[PRIV_VEC]]
245 // CHECK-DAG: [[PRIV_SIVAR]]
249 // CHECK: define internal noundef i32 [[DESTRUCTORS]](i32 noundef %0, ptr noalias noundef %1)
250 // CHECK: [[PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_MAIN_TY]], ptr [[RES_KMP_TASK:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 1
251 // CHECK: [[PRIVATE_S_ARR_REF:%.+]] = getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 0
252 // CHECK: [[PRIVATE_VAR_REF:%.+]] = getelementptr inbounds [[PRIVATES_MAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 1
253 // CHECK: call void [[S_DOUBLE_TY_DESTR]](ptr {{[^,]*}} [[PRIVATE_VAR_REF]])
254 // CHECK: getelementptr inbounds [2 x [[S_DOUBLE_TY]]], ptr [[PRIVATE_S_ARR_REF]], i{{.+}} 0, i{{.+}} 0
255 // CHECK: getelementptr inbounds [[S_DOUBLE_TY]], ptr %{{.+}}, i{{.+}} 2
256 // CHECK: [[PRIVATE_S_ARR_ELEM_REF:%.+]] = getelementptr inbounds [[S_DOUBLE_TY]], ptr %{{.+}}, i{{.+}} -1
257 // CHECK: call void [[S_DOUBLE_TY_DESTR]](ptr {{[^,]*}} [[PRIVATE_S_ARR_ELEM_REF]])
262 // CHECK: define {{.*}} i{{[0-9]+}} [[TMAIN_INT]]()
263 // CHECK: [[TEST:%.+]] = alloca [[S_INT_TY]],
264 // CHECK: [[T_VAR_ADDR:%.+]] = alloca i32,
265 // CHECK: [[VEC_ADDR:%.+]] = alloca [2 x i32],
266 // CHECK: [[S_ARR_ADDR:%.+]] = alloca [2 x [[S_INT_TY]]],
267 // CHECK: [[VAR_ADDR:%.+]] = alloca [[S_INT_TY]],
268 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(ptr [[LOC:@.+]])
270 // CHECK: call {{.*}} [[S_INT_TY_DEF_CONSTR:@.+]](ptr {{[^,]*}} [[TEST]])
272 // Do not store original variables in capture struct.
273 // CHECK-NOT: getelementptr inbounds [[CAP_TMAIN_TY]],
276 // Returns struct kmp_task_t {
277 // [[KMP_TASK_T_TY]] task_data;
278 // [[KMP_TASK_TMAIN_TY]] privates;
280 // CHECK: [[RES:%.+]] = call ptr @__kmpc_omp_task_alloc(ptr [[LOC]], i32 [[GTID]], i32 9, i64 256, i64 1, ptr [[TASK_ENTRY:@[^ ]+]])
282 // CHECK: [[TASK:%.+]] = getelementptr inbounds [[KMP_TASK_TMAIN_TY]], ptr [[RES]], i{{[0-9]+}} 0, i{{[0-9]+}} 0
284 // Initialize kmp_task_t->privates with default values (no init for simple types, default constructors for classes).
285 // CHECK: [[PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_TMAIN_TY]], ptr [[RES]], i{{[0-9]+}} 0, i{{[0-9]+}} 2
287 // Constructors for s_arr and var.
289 // CHECK: [[PRIVATE_S_ARR_REF:%.+]] = getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i{{[0-9]+}} 0, i{{[0-9]+}} 2
290 // CHECK: getelementptr inbounds [2 x [[S_INT_TY]]], ptr [[PRIVATE_S_ARR_REF]], i{{.+}} 0, i{{.+}} 0
291 // CHECK: getelementptr inbounds [[S_INT_TY]], ptr %{{.+}}, i{{.+}} 2
292 // CHECK: call void [[S_INT_TY_DEF_CONSTR]](ptr {{[^,]*}} [[S_ARR_CUR:%.+]])
293 // CHECK: getelementptr inbounds [[S_INT_TY]], ptr [[S_ARR_CUR]], i{{.+}} 1
298 // CHECK: [[PRIVATE_VAR_REF:%.+]] = getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 3
299 // CHECK: call void [[S_INT_TY_DEF_CONSTR]](ptr {{[^,]*}} [[PRIVATE_VAR_REF:%.+]])
301 // Provide pointer to destructor function, which will destroy private variables at the end of the task.
302 // CHECK: [[DESTRUCTORS_REF:%.+]] = getelementptr inbounds [[KMP_TASK_T_TY]], ptr [[TASK]], i{{.+}} 0, i{{.+}} 3
303 // CHECK: store ptr [[DESTRUCTORS:@.+]], ptr [[DESTRUCTORS_REF]],
306 // CHECK: call i32 @__kmpc_omp_task(ptr [[LOC]], i32 [[GTID]], ptr [[RES]])
308 // No destructors must be called for private copies of s_arr and var.
309 // CHECK-NOT: getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 2
310 // CHECK-NOT: getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 3
311 // CHECK: call void [[S_INT_TY_DESTR:@.+]](ptr
312 // CHECK-NOT: getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 2
313 // CHECK-NOT: getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 3
317 // CHECK: define internal void [[PRIVATES_MAP_FN:@.+]](ptr noalias noundef %0, ptr noalias noundef %1, ptr noalias noundef %2, ptr noalias noundef %3, ptr noalias noundef %4)
318 // CHECK: [[PRIVATES:%.+]] = load ptr, ptr
319 // CHECK: [[PRIV_T_VAR:%.+]] = getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i32 0, i32 0
320 // CHECK: [[ARG1:%.+]] = load ptr, ptr %{{.+}},
321 // CHECK: store ptr [[PRIV_T_VAR]], ptr [[ARG1]],
322 // CHECK: [[PRIV_VEC:%.+]] = getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i32 0, i32 1
323 // CHECK: [[ARG2:%.+]] = load ptr, ptr %{{.+}},
324 // CHECK: store ptr [[PRIV_VEC]], ptr [[ARG2]],
325 // CHECK: [[PRIV_S_VAR:%.+]] = getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i32 0, i32 2
326 // CHECK: [[ARG3:%.+]] = load ptr, ptr %{{.+}},
327 // CHECK: store ptr [[PRIV_S_VAR]], ptr [[ARG3]],
328 // CHECK: [[PRIV_VAR:%.+]] = getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i32 0, i32 3
329 // CHECK: [[ARG4:%.+]] = load ptr, ptr {{.+}},
330 // CHECK: store ptr [[PRIV_VAR]], ptr [[ARG4]],
333 // CHECK: define internal noundef i32 [[TASK_ENTRY]](i32 noundef %0, ptr noalias noundef %1)
336 // CHECK-DAG: [[PRIV_T_VAR_ADDR:%.+]] = alloca ptr,
337 // CHECK-DAG: [[PRIV_VEC_ADDR:%.+]] = alloca ptr,
338 // CHECK-DAG: [[PRIV_S_ARR_ADDR:%.+]] = alloca ptr,
339 // CHECK-DAG: [[PRIV_VAR_ADDR:%.+]] = alloca ptr,
340 // CHECK: store ptr [[PRIVATES_MAP_FN]], ptr [[MAP_FN_ADDR:%.+]],
341 // CHECK: [[MAP_FN:%.+]] = load ptr, ptr [[MAP_FN_ADDR]],
342 // CHECK: call void [[MAP_FN]](ptr %{{.+}}, ptr [[PRIV_T_VAR_ADDR]], ptr [[PRIV_VEC_ADDR]], ptr [[PRIV_S_ARR_ADDR]], ptr [[PRIV_VAR_ADDR]])
343 // CHECK: [[PRIV_T_VAR:%.+]] = load ptr, ptr [[PRIV_T_VAR_ADDR]],
344 // CHECK: [[PRIV_VEC:%.+]] = load ptr, ptr [[PRIV_VEC_ADDR]],
345 // CHECK: [[PRIV_S_ARR:%.+]] = load ptr, ptr [[PRIV_S_ARR_ADDR]],
346 // CHECK: [[PRIV_VAR:%.+]] = load ptr, ptr [[PRIV_VAR_ADDR]],
348 // Privates actually are used.
349 // CHECK-DAG: [[PRIV_VAR]]
350 // CHECK-DAG: [[PRIV_T_VAR]]
351 // CHECK-DAG: [[PRIV_S_ARR]]
352 // CHECK-DAG: [[PRIV_VEC]]
356 // CHECK: define internal noundef i32 [[DESTRUCTORS]](i32 noundef %0, ptr noalias noundef %1)
357 // CHECK: [[PRIVATES:%.+]] = getelementptr inbounds [[KMP_TASK_TMAIN_TY]], ptr [[RES_KMP_TASK:%.+]], i{{[0-9]+}} 0, i{{[0-9]+}} 2
358 // CHECK: [[PRIVATE_S_ARR_REF:%.+]] = getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 2
359 // CHECK: [[PRIVATE_VAR_REF:%.+]] = getelementptr inbounds [[PRIVATES_TMAIN_TY]], ptr [[PRIVATES]], i{{.+}} 0, i{{.+}} 3
360 // CHECK: call void [[S_INT_TY_DESTR]](ptr {{[^,]*}} [[PRIVATE_VAR_REF]])
361 // CHECK: getelementptr inbounds [2 x [[S_INT_TY]]], ptr [[PRIVATE_S_ARR_REF]], i{{.+}} 0, i{{.+}} 0
362 // CHECK: getelementptr inbounds [[S_INT_TY]], ptr %{{.+}}, i{{.+}} 2
363 // CHECK: [[PRIVATE_S_ARR_ELEM_REF:%.+]] = getelementptr inbounds [[S_INT_TY]], ptr %{{.+}}, i{{.+}} -1
364 // CHECK: call void [[S_INT_TY_DESTR]](ptr {{[^,]*}} [[PRIVATE_S_ARR_ELEM_REF]])
371 // ARRAY-LABEL: array_func
375 St
&operator=(const St
&) { return *this; };
379 void array_func(int n
, float a
[n
], St s
[2]) {
380 // ARRAY: call ptr @__kmpc_omp_task_alloc(
381 // ARRAY: call i32 @__kmpc_omp_task(
382 // ARRAY: store ptr %{{.+}}, ptr %{{.+}},
383 // ARRAY: store ptr %{{.+}}, ptr %{{.+}},
384 #pragma omp task private(a, s)