xref: /llvm-project/clang/test/OpenMP/task_in_task_firstprivate_codegen.cpp (revision 94473f4db6a6f5f12d7c4081455b5b596094eac5)
1 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp -x c++ -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4 
5 // RUN: %clang_cc1 -verify -triple x86_64-apple-darwin10 -fopenmp-simd -x c++ -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
6 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-apple-darwin10 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-apple-darwin10 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
8 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
9 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
12 
13 // CHECK: @main
14 int main() {
15   double var = 0;
16   // Check that var is firstprivatized in the outermost task.
17   // CHECK: [[BASE:%.+]] = call ptr @__kmpc_omp_task_alloc(ptr @{{.+}}, i32 {{.+}}, i32 1, i64 48, i64 1, ptr @{{.+}})
18   // CHECK: [[PRIVS:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr [[BASE]], i32 0, i32 1
19   // CHECK: [[VAR_FP:%.+]] = getelementptr inbounds nuw %{{.+}}, ptr [[PRIVS]], i32 0, i32 0
20   // CHECK: [[VAR_VAL:%.+]] = load double, ptr %{{.+}},
21   // CHECK: store double [[VAR_VAL]], ptr [[VAR_FP]],
22   // CHECK: call i32 @__kmpc_omp_task(ptr @{{.+}}, i32 %{{.+}}, ptr [[BASE]])
23 #pragma omp task
24 #pragma omp task
25   var += 1;
26   return 0;
27 }
28 
29 #endif
30