[TySan] Don't report globals with incomplete types. (#121922)
[llvm-project.git] / clang / test / OpenMP / master_taskloop_simd_ast_print.cpp
blob84fa1eebc164da7331f162cc86393d331fd3f3aa
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -DOMP5 -ast-print %s | FileCheck %s --check-prefix CHECK --check-prefix OMP50
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -DOMP5 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=50 -DOMP5 -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s --check-prefix CHECK --check-prefix OMP50
5 // RUN: %clang_cc1 -verify -fopenmp -ast-print %s -DOMP51 | FileCheck %s --check-prefix CHECK --check-prefix OMP51
6 // RUN: %clang_cc1 -fopenmp -x c++ -std=c++11 -emit-pch -o %t %s -DOMP51
7 // RUN: %clang_cc1 -fopenmp -std=c++11 -include-pch %t -verify %s -ast-print -DOMP51 | FileCheck %s --check-prefix CHECK --check-prefix OMP51
9 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -DOMP5 -ast-print %s | FileCheck %s --check-prefix CHECK --check-prefix OMP50
10 // RUN: %clang_cc1 -fopenmp-simd -DOMP5 -fopenmp-version=50 -x c++ -std=c++11 -emit-pch -o %t %s
11 // RUN: %clang_cc1 -fopenmp-simd -DOMP5 -fopenmp-version=50 -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s --check-prefix CHECK --check-prefix OMP50
13 // RUN: %clang_cc1 -verify -fopenmp-simd -DOMP51 -ast-print %s | FileCheck %s --check-prefix CHECK --check-prefix OMP51
14 // RUN: %clang_cc1 -fopenmp-simd -DOMP51 -x c++ -std=c++11 -emit-pch -o %t %s
15 // RUN: %clang_cc1 -fopenmp-simd -DOMP51 -std=c++11 -include-pch %t -verify %s -ast-print | FileCheck %s --check-prefix CHECK --check-prefix OMP51
16 // expected-no-diagnostics
18 #ifndef HEADER
19 #define HEADER
21 void foo() {}
23 template <class T, int N>
24 T tmain(T argc) {
25 T b = argc, c, d, e, f, g;
26 T *ptr;
27 static T a;
28 // CHECK: static T a;
29 #pragma omp taskgroup task_reduction(+: d) allocate(d)
30 #pragma omp master taskloop simd allocate(d) if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+:g) in_reduction(+: d)
31 // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d) allocate(d)
32 // CHECK-NEXT: #pragma omp master taskloop simd allocate(d) if(taskloop: argc > N) default(shared) untied priority(N) safelen(N) linear(c) aligned(ptr) grainsize(N) reduction(+: g) in_reduction(+: d){{$}}
33 for (int i = 0; i < 2; ++i)
34 a = 2;
35 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
36 // CHECK-NEXT: a = 2;
37 #pragma omp parallel
38 #pragma omp master taskloop simd private(argc, b), firstprivate(c, d), lastprivate(d, f) collapse(N) shared(g) if (c) final(d) mergeable priority(f) simdlen(N) nogroup num_tasks(N)
39 for (int i = 0; i < 2; ++i)
40 for (int j = 0; j < 2; ++j)
41 for (int j = 0; j < 2; ++j)
42 for (int j = 0; j < 2; ++j)
43 for (int j = 0; j < 2; ++j)
44 for (int i = 0; i < 2; ++i)
45 for (int j = 0; j < 2; ++j)
46 for (int j = 0; j < 2; ++j)
47 for (int j = 0; j < 2; ++j)
48 for (int j = 0; j < 2; ++j)
49 foo();
50 // CHECK-NEXT: #pragma omp parallel
51 // CHECK-NEXT: #pragma omp master taskloop simd private(argc,b) firstprivate(c,d) lastprivate(d,f) collapse(N) shared(g) if(c) final(d) mergeable priority(f) simdlen(N) nogroup num_tasks(N)
52 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
53 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
54 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
55 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
56 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
57 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
58 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
59 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
60 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
61 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
62 // CHECK-NEXT: foo();
63 return T();
66 // CHECK-LABEL: int main(int argc, char **argv) {
67 int main(int argc, char **argv) {
68 int b = argc, c, d, e, f, g, h;
69 static int a;
70 // CHECK: static int a;
71 #pragma omp taskgroup task_reduction(+: d)
72 #pragma omp master taskloop simd if(taskloop: a) default(none) shared(a) final(b) priority(5) safelen(8) linear(b), aligned(argv) num_tasks(argc) reduction(*: g) in_reduction(+: d)
73 // CHECK-NEXT: #pragma omp taskgroup task_reduction(+: d)
74 // CHECK-NEXT: #pragma omp master taskloop simd if(taskloop: a) default(none) shared(a) final(b) priority(5) safelen(8) linear(b) aligned(argv) num_tasks(argc) reduction(*: g) in_reduction(+: d)
75 for (int i = 0; i < 2; ++i)
76 a = 2;
77 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
78 // CHECK-NEXT: a = 2;
79 #pragma omp parallel
80 #ifdef OMP51
81 #pragma omp master taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd:argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e) nontemporal(argc, c, d) order(unconstrained:concurrent)
82 #elif OMP5
83 #pragma omp master taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(simd:argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e) nontemporal(argc, c, d) order(concurrent)
84 #else
85 #pragma omp master taskloop simd private(argc, b), firstprivate(argv, c), lastprivate(d, f) collapse(2) shared(g) if(argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a, e)
86 #endif // OMP51
87 for (int i = 0; i < 10; ++i)
88 for (int j = 0; j < 10; ++j)
89 foo();
90 // CHECK-NEXT: #pragma omp parallel
91 // OMP50-NEXT: #pragma omp master taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e) nontemporal(argc,c,d) order(concurrent)
92 // OMP51-NEXT: #pragma omp master taskloop simd private(argc,b) firstprivate(argv,c) lastprivate(d,f) collapse(2) shared(g) if(simd: argc) mergeable priority(argc) simdlen(16) grainsize(argc) reduction(max: a,e) nontemporal(argc,c,d) order(unconstrained: concurrent)
93 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
94 // CHECK-NEXT: for (int j = 0; j < 10; ++j)
95 // CHECK-NEXT: foo();
96 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
99 #endif