Skip to content

Commit eb88e7c

Browse files
authored
[Frontend][OpenMP] Remove reduction from allowed clauses for target (#90754)
The "reduction" clause is not allowed on the "target" construct.
1 parent 05e6bb4 commit eb88e7c

File tree

7 files changed

+11
-574
lines changed

7 files changed

+11
-574
lines changed

clang/test/Analysis/cfg-openmp.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,21 +195,20 @@ void xxx(int argc) {
195195
#pragma omp single
196196
argc = x;
197197
// CHECK-NEXT: [[#TARGET:]]:
198-
// CHECK-SAME: [B1.[[#TARGET+10]]]
199-
// CHECK-NEXT: [[#TARGET+1]]: [B1.[[#TARGET+10]]] (ImplicitCastExpr, LValueToRValue, int)
200-
// CHECK-NEXT: [[#TARGET+2]]: [B1.[[#TARGET+9]]]
201-
// CHECK-NEXT: [[#TARGET+3]]: [B1.[[#TARGET+9]]] = [B1.[[#TARGET+1]]]
198+
// CHECK-SAME: [B1.[[#TARGET+9]]]
199+
// CHECK-NEXT: [[#TARGET+1]]: [B1.[[#TARGET+9]]] (ImplicitCastExpr, LValueToRValue, int)
200+
// CHECK-NEXT: [[#TARGET+2]]: [B1.[[#TARGET+8]]]
201+
// CHECK-NEXT: [[#TARGET+3]]: [B1.[[#TARGET+8]]] = [B1.[[#TARGET+1]]]
202202
// CHECK-NEXT: [[#TARGET+4]]: cond
203203
// CHECK-NEXT: [[#TARGET+5]]: [B1.[[#TARGET+4]]] (ImplicitCastExpr, LValueToRValue, int)
204204
// CHECK-NEXT: [[#TARGET+6]]: [B1.[[#TARGET+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool)
205205
// CHECK-NEXT: [[#TARGET+7]]: fp
206-
// CHECK-NEXT: [[#TARGET+8]]: rd
207-
// CHECK-NEXT: [[#TARGET+9]]: argc
208-
// CHECK-NEXT: [[#TARGET+10]]: x
209-
// CHECK-NEXT: [[#TARGET+11]]: #pragma omp target depend(in : argc) if(cond) firstprivate(fp) reduction(-: rd)
206+
// CHECK-NEXT: [[#TARGET+8]]: argc
207+
// CHECK-NEXT: [[#TARGET+9]]: x
208+
// CHECK-NEXT: [[#TARGET+10]]: #pragma omp target depend(in : argc) if(cond) firstprivate(fp)
210209
// CHECK-NEXT: [B1.[[#TARGET+3]]];
211210
#pragma omp target depend(in \
212-
: argc) if(cond) firstprivate(fp) reduction(-:rd)
211+
: argc) if(cond) firstprivate(fp)
213212
argc = x;
214213
// CHECK-NEXT: [[#TP:]]:
215214
// CHECK-SAME: [B1.[[#TP+11]]]

clang/test/OpenMP/nvptx_target_cuda_mode_messages.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,6 @@ int foo(int n, double *ptr) {
4646
return a;
4747
}
4848

49-
template <typename tx>
50-
tx ftemplate(int n) {
51-
tx a = 0;
52-
tx b[10];
53-
54-
#pragma omp target reduction(+ \
55-
: a, b) // expected-note {{defined as threadprivate or thread local}}
56-
{
57-
int e; // expected-note {{defined as threadprivate or thread local}}
58-
#pragma omp parallel shared(a, e) // expected-error 2 {{threadprivate or thread local variable cannot be shared}}
59-
a += 1;
60-
b[2] += 1;
61-
}
62-
63-
return a;
64-
}
65-
6649
static int fstatic(int n) {
6750
int a = 0;
6851
char aaa = 0;
@@ -101,7 +84,6 @@ int bar(int n, double *ptr) {
10184
S1 S;
10285
a += S.r1(n);
10386
a += fstatic(n);
104-
a += ftemplate<int>(n); // expected-note {{in instantiation of function template specialization 'ftemplate<int>' requested here}}
10587

10688
return a;
10789
}

clang/test/OpenMP/target_reduction_codegen.cpp

Lines changed: 0 additions & 231 deletions
This file was deleted.

0 commit comments

Comments
 (0)