Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / OpenMP / teams_distribute_parallel_for_schedule_messages.cpp
blob8c8fa77ea02c9a4a08cfb2f4911c6eed6052a6f6
1 // RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized
3 // RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized
5 void foo() {
8 bool foobool(int argc) {
9 return argc;
12 struct S1; // expected-note {{declared here}}
14 template <class T, typename S, int N, int ST> // expected-note {{declared here}}
15 T tmain(T argc, S **argv) {
16 T k;
17 // expected-error@+2 {{expected '(' after 'schedule'}}
18 #pragma omp target
19 #pragma omp teams distribute parallel for schedule
20 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
22 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
23 #pragma omp target
24 #pragma omp teams distribute parallel for schedule (
25 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
27 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}
28 #pragma omp target
29 #pragma omp teams distribute parallel for schedule ()
30 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
32 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
33 #pragma omp target
34 #pragma omp teams distribute parallel for schedule (auto
35 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
37 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
38 #pragma omp target
39 #pragma omp teams distribute parallel for schedule (auto_dynamic
40 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
42 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
43 #pragma omp target
44 #pragma omp teams distribute parallel for schedule (auto,
45 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
47 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
48 #pragma omp target
49 #pragma omp teams distribute parallel for schedule (runtime, 3)
50 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
52 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
53 #pragma omp target
54 #pragma omp teams distribute parallel for schedule (guided argc
55 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
57 // expected-error@+2 2 {{argument to 'schedule' clause must be a strictly positive integer value}}
58 #pragma omp target
59 #pragma omp teams distribute parallel for schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}}
60 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
62 // expected-warning@+2 {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
63 #pragma omp target
64 #pragma omp teams distribute parallel for schedule (dynamic, 1))
65 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
67 #pragma omp target
68 #pragma omp teams distribute parallel for schedule (guided, (ST > 0) ? 1 + ST : 2)
69 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
71 // expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'schedule' clause}}
72 // expected-error@+2 {{argument to 'schedule' clause must be a strictly positive integer value}}
73 #pragma omp target
74 #pragma omp teams distribute parallel for schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5)
75 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
77 // expected-error@+2 {{'S' does not refer to a value}}
78 #pragma omp target
79 #pragma omp teams distribute parallel for schedule (static, S)
80 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
82 // expected-error@+3 2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
83 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
84 #pragma omp target
85 #pragma omp teams distribute parallel for schedule (guided, argv[1]=2)
86 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
88 #pragma omp target
89 #pragma omp teams distribute parallel for schedule (dynamic, k)
90 for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
92 // expected-error@+2 {{argument to 'schedule' clause must be a strictly positive integer value}}
93 #pragma omp target
94 #pragma omp teams distribute parallel for schedule (static, N)
95 for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST];
97 return argc;
100 int main(int argc, char **argv) {
101 // expected-error@+2 {{expected '(' after 'schedule'}}
102 #pragma omp target
103 #pragma omp teams distribute parallel for schedule
104 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
106 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
107 #pragma omp target
108 #pragma omp teams distribute parallel for schedule (
109 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
111 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}}
112 #pragma omp target
113 #pragma omp teams distribute parallel for schedule ()
114 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
116 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
117 #pragma omp target
118 #pragma omp teams distribute parallel for schedule (auto
119 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
121 // expected-error@+2 {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
122 #pragma omp target
123 #pragma omp teams distribute parallel for schedule (auto_dynamic
124 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
126 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
127 #pragma omp target
128 #pragma omp teams distribute parallel for schedule (auto,
129 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
131 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
132 #pragma omp target
133 #pragma omp teams distribute parallel for schedule (runtime, 3)
134 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
136 // expected-error@+2 {{expected ')'}} expected-note@+2 {{to match this '('}}
137 #pragma omp target
138 #pragma omp teams distribute parallel for schedule (guided, 4
139 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
141 // expected-warning@+2 {{extra tokens at the end of '#pragma omp teams distribute parallel for' are ignored}}
142 #pragma omp target
143 #pragma omp teams distribute parallel for schedule (static, 2+2))
144 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
146 #pragma omp target
147 #pragma omp teams distribute parallel for schedule (dynamic, foobool(1) > 0 ? 1 : 2)
148 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
150 // expected-error@+3 2 {{directive '#pragma omp teams distribute parallel for' cannot contain more than one 'schedule' clause}}
151 // expected-error@+2 {{argument to 'schedule' clause must be a strictly positive integer value}}
152 #pragma omp target
153 #pragma omp teams distribute parallel for schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5)
154 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
156 // expected-error@+2 {{'S1' does not refer to a value}}
157 #pragma omp target
158 #pragma omp teams distribute parallel for schedule (guided, S1)
159 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
161 // expected-error@+3 {{expected ')'}} expected-note@+3 {{to match this '('}}
162 // expected-error@+2 {{expression must have integral or unscoped enumeration type, not 'char *'}}
163 #pragma omp target
164 #pragma omp teams distribute parallel for schedule (static, argv[1]=2)
165 for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4];
167 // expected-error@+4 {{statement after '#pragma omp teams distribute parallel for' must be a for loop}}
168 // expected-note@+2 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}}
169 #pragma omp target
170 #pragma omp teams distribute parallel for schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}}
171 foo();
173 // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}}
174 return tmain<int, char, 1, 0>(argc, argv);