Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / taskloop_strict_modifier_ast_print.cpp
blob84538582108c40280313bfe6bdbd68bfd1d1dce7
1 // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=51 -ast-print %s | FileCheck %s
2 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s
3 // RUN: %clang_cc1 -fopenmp -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
5 // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=51 -ast-print %s | FileCheck %s
6 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -x c++ -std=c++11 -emit-pch -o %t %s
7 // RUN: %clang_cc1 -fopenmp-simd -fopenmp-version=51 -std=c++11 -include-pch %t -fsyntax-only -verify %s -ast-print | FileCheck %s
8 // expected-no-diagnostics
10 #ifndef HEADER
11 #define HEADER
13 void foo() {}
15 template <class T, int N>
16 T tmain(T argc) {
17 T b = argc, c, d, e, f, g;
18 static T a;
19 // CHECK: static T a;
20 #pragma omp taskgroup
21 #pragma omp taskloop grainsize(strict: N)
22 // CHECK-NEXT: #pragma omp taskgroup
23 // CHECK-NEXT: #pragma omp taskloop grainsize(strict: N)
24 for (int i = 0; i < 2; ++i)
25 a = 2;
26 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
27 // CHECK-NEXT: a = 2;
28 #pragma omp parallel
29 #pragma omp taskloop grainsize(strict: N)
30 for (int i = 0; i < 2; ++i)
31 for (int j = 0; j < 2; ++j)
32 for (int j = 0; j < 2; ++j)
33 for (int j = 0; j < 2; ++j)
34 for (int j = 0; j < 2; ++j)
35 for (int i = 0; i < 2; ++i)
36 for (int j = 0; j < 2; ++j)
37 for (int j = 0; j < 2; ++j)
38 for (int j = 0; j < 2; ++j)
39 for (int j = 0; j < 2; ++j) {
40 #pragma omp cancel taskgroup
41 #pragma omp cancellation point taskgroup
42 foo();
44 // CHECK-NEXT: #pragma omp parallel
45 // CHECK-NEXT: #pragma omp taskloop grainsize(strict: N)
46 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
47 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
48 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
49 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
50 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
51 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
52 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
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: #pragma omp cancel taskgroup
57 // CHECK-NEXT: #pragma omp cancellation point taskgroup
58 // CHECK-NEXT: foo();
60 #pragma omp taskgroup
61 #pragma omp taskloop num_tasks(strict: N)
62 // CHECK: #pragma omp taskgroup
63 // CHECK-NEXT: #pragma omp taskloop num_tasks(strict: N)
64 for (int i = 0; i < 2; ++i)
65 a = 2;
66 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
67 // CHECK-NEXT: a = 2;
68 #pragma omp parallel
69 #pragma omp taskloop num_tasks(strict: N)
70 for (int i = 0; i < 2; ++i)
71 for (int j = 0; j < 2; ++j)
72 for (int j = 0; j < 2; ++j)
73 for (int j = 0; j < 2; ++j)
74 for (int j = 0; j < 2; ++j)
75 for (int i = 0; i < 2; ++i)
76 for (int j = 0; j < 2; ++j)
77 for (int j = 0; j < 2; ++j)
78 for (int j = 0; j < 2; ++j)
79 for (int j = 0; j < 2; ++j) {
80 #pragma omp cancel taskgroup
81 #pragma omp cancellation point taskgroup
82 foo();
84 // CHECK-NEXT: #pragma omp parallel
85 // CHECK-NEXT: #pragma omp taskloop num_tasks(strict: N)
86 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
87 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
88 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
89 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
90 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
91 // CHECK-NEXT: for (int i = 0; i < 2; ++i)
92 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
93 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
94 // CHECK-NEXT: for (int j = 0; j < 2; ++j)
95 // CHECK-NEXT: for (int j = 0; j < 2; ++j) {
96 // CHECK-NEXT: #pragma omp cancel taskgroup
97 // CHECK-NEXT: #pragma omp cancellation point taskgroup
98 // CHECK-NEXT: foo();
99 return T();
102 // CHECK-LABEL: int main(int argc, char **argv) {
103 int main(int argc, char **argv) {
104 int b = argc, c, d, e, f, g;
105 int tid = 0;
106 static int a;
107 // CHECK: static int a;
108 #pragma omp taskloop grainsize(strict: argc)
109 for (int i = 0; i < 10; ++i)
110 foo();
111 // CHECK-NEXT: #pragma omp taskloop grainsize(strict: argc)
112 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
113 // CHECK-NEXT: foo();
115 #pragma omp parallel
116 #pragma omp masked taskloop grainsize(strict: argc)
117 for (int i = 0; i < 10; ++i)
118 foo();
119 // CHECK: #pragma omp parallel
120 // CHECK-NEXT: #pragma omp masked taskloop grainsize(strict: argc)
121 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
122 // CHECK-NEXT: foo();
124 #pragma omp parallel
125 #pragma omp masked taskloop simd grainsize(strict: argc)
126 for (int i = 0; i < 10; ++i)
127 foo();
128 // CHECK: #pragma omp parallel
129 // CHECK-NEXT: #pragma omp masked taskloop simd grainsize(strict: argc)
130 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
131 // CHECK-NEXT: foo();
133 #pragma omp parallel masked taskloop grainsize(strict: argc)
134 for (int i = 0; i < 10; ++i)
135 foo();
136 // CHECK-NEXT: #pragma omp parallel masked taskloop grainsize(strict: argc)
137 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
138 // CHECK-NEXT: foo();
140 #pragma omp parallel masked taskloop simd grainsize(strict: argc)
141 for (int i = 0; i < 10; ++i)
142 foo();
143 // CHECK-NEXT: #pragma omp parallel masked taskloop simd grainsize(strict: argc)
144 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
145 // CHECK-NEXT: foo();
147 #pragma omp parallel
148 #pragma omp master taskloop grainsize(strict: argc)
149 for (int i = 0; i < 10; ++i)
150 foo();
151 // CHECK: #pragma omp parallel
152 // CHECK-NEXT: #pragma omp master taskloop grainsize(strict: argc)
153 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
154 // CHECK-NEXT: foo();
156 #pragma omp parallel
157 #pragma omp master taskloop simd grainsize(strict: argc)
158 for (int i = 0; i < 10; ++i)
159 foo();
160 // CHECK: #pragma omp parallel
161 // CHECK-NEXT: #pragma omp master taskloop simd grainsize(strict: argc)
162 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
163 // CHECK-NEXT: foo();
165 #pragma omp parallel master taskloop grainsize(strict: argc)
166 for (int i = 0; i < 10; ++i)
167 foo();
168 // CHECK-NEXT: #pragma omp parallel master taskloop grainsize(strict: argc)
169 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
170 // CHECK-NEXT: foo();
172 #pragma omp parallel master taskloop simd grainsize(strict: argc)
173 for (int i = 0; i < 10; ++i)
174 foo();
175 // CHECK-NEXT: #pragma omp parallel master taskloop simd grainsize(strict: argc)
176 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
177 // CHECK-NEXT: foo();
179 #pragma omp taskloop num_tasks(strict: argc)
180 for (int i = 0; i < 10; ++i)
181 foo();
182 // CHECK: #pragma omp taskloop num_tasks(strict: argc)
183 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
184 // CHECK-NEXT: foo();
186 #pragma omp parallel
187 #pragma omp masked taskloop num_tasks(strict: argc)
188 for (int i = 0; i < 10; ++i)
189 foo();
190 // CHECK: #pragma omp parallel
191 // CHECK-NEXT: #pragma omp masked taskloop num_tasks(strict: argc)
192 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
193 // CHECK-NEXT: foo();
195 #pragma omp parallel
196 #pragma omp masked taskloop simd num_tasks(strict: argc)
197 for (int i = 0; i < 10; ++i)
198 foo();
199 // CHECK: #pragma omp parallel
200 // CHECK-NEXT: #pragma omp masked taskloop simd num_tasks(strict: argc)
201 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
202 // CHECK-NEXT: foo();
204 #pragma omp parallel masked taskloop num_tasks(strict: argc)
205 for (int i = 0; i < 10; ++i)
206 foo();
207 // CHECK-NEXT: #pragma omp parallel masked taskloop num_tasks(strict: argc)
208 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
209 // CHECK-NEXT: foo();
211 #pragma omp parallel masked taskloop simd num_tasks(strict: argc)
212 for (int i = 0; i < 10; ++i)
213 foo();
214 // CHECK-NEXT: #pragma omp parallel masked taskloop simd num_tasks(strict: argc)
215 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
216 // CHECK-NEXT: foo();
218 #pragma omp parallel
219 #pragma omp master taskloop num_tasks(strict: argc)
220 for (int i = 0; i < 10; ++i)
221 foo();
222 // CHECK: #pragma omp parallel
223 // CHECK-NEXT: #pragma omp master taskloop num_tasks(strict: argc)
224 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
225 // CHECK-NEXT: foo();
227 #pragma omp parallel
228 #pragma omp master taskloop simd num_tasks(strict: argc)
229 for (int i = 0; i < 10; ++i)
230 foo();
231 // CHECK: #pragma omp parallel
232 // CHECK-NEXT: #pragma omp master taskloop simd num_tasks(strict: argc)
233 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
234 // CHECK-NEXT: foo();
236 #pragma omp parallel master taskloop num_tasks(strict: argc)
237 for (int i = 0; i < 10; ++i)
238 foo();
239 // CHECK-NEXT: #pragma omp parallel master taskloop num_tasks(strict: argc)
240 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
241 // CHECK-NEXT: foo();
243 #pragma omp parallel master taskloop simd num_tasks(strict: argc)
244 for (int i = 0; i < 10; ++i)
245 foo();
246 // CHECK-NEXT: #pragma omp parallel master taskloop simd num_tasks(strict: argc)
247 // CHECK-NEXT: for (int i = 0; i < 10; ++i)
248 // CHECK-NEXT: foo();
250 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0]));
253 #endif