[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / OpenMP / taskyield_codegen.cpp
blob65f144fc300673ad168cfe7059839e9eeae750f7
1 // RUN: %clang_cc1 -verify -fopenmp -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
4 //
5 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp -fopenmp-enable-irbuilder -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck %s
9 // RUN: %clang_cc1 -verify -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -emit-llvm %s -o - | FileCheck --check-prefix SIMD-ONLY0 %s
10 // RUN: %clang_cc1 -fopenmp-simd -x c++ -std=c++11 -triple x86_64-unknown-unknown -emit-pch -o %t %s
11 // RUN: %clang_cc1 -fopenmp-simd -x c++ -triple x86_64-unknown-unknown -std=c++11 -include-pch %t -verify %s -emit-llvm -o - | FileCheck --check-prefix SIMD-ONLY0 %s
12 // SIMD-ONLY0-NOT: {{__kmpc|__tgt}}
13 // expected-no-diagnostics
14 #ifndef HEADER
15 #define HEADER
17 // CHECK: [[IDENT_T:%.+]] = type { i32, i32, i32, i32, ptr }
19 void foo() {}
21 template <class T>
22 T tmain(T argc) {
23 static T a;
24 #pragma omp taskyield
25 return a + argc;
28 // CHECK-LABEL: @main
29 int main(int argc, char **argv) {
30 static int a;
31 #pragma omp taskyield
32 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(ptr @{{.+}})
33 // CHECK: call i32 @__kmpc_omp_taskyield(ptr @{{.+}}, i32 [[GTID]], i32 0)
34 // CHECK: call {{.+}} [[TMAIN_INT:@.+]](i{{[0-9][0-9]}}
35 // CHECK: call {{.+}} [[TMAIN_CHAR:@.+]](i{{[0-9]}}
36 return tmain(argc) + tmain(argv[0][0]) + a;
39 // CHECK: define {{.+}} [[TMAIN_INT]](
40 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(ptr @{{.+}})
41 // CHECK: call i32 @__kmpc_omp_taskyield(ptr @{{.+}}, i32 [[GTID]], i32 0)
43 // CHECK: define {{.+}} [[TMAIN_CHAR]](
44 // CHECK: [[GTID:%.+]] = call i32 @__kmpc_global_thread_num(ptr @{{.+}})
45 // CHECK: call i32 @__kmpc_omp_taskyield(ptr @{{.+}}, i32 [[GTID]], i32 0)
47 #endif