From 9cb2a086af566683f0ac372e20dfa40a60ae55fa Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Fri, 26 Jul 2019 14:50:05 +0000 Subject: [PATCH] [OPENMP]Add support for analysis of reduction variables. Summary: Reduction variables are the variables, for which the private copies must be created in the OpenMP regions. Then they are initialized with the predefined values depending on the reduction operation. After exit from the OpenMP region the original variable is updated using the reduction value and the value of the original reduction variable. Reviewers: NoQ Subscribers: guansong, jdoerfert, caomhin, kkwli0, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D65106 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@367116 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/OpenMPClause.h | 6 +- test/Analysis/cfg-openmp.cpp | 313 ++++++++++-------- ...ribute_parallel_for_reduction_messages.cpp | 8 + ...e_parallel_for_simd_reduction_messages.cpp | 7 + .../distribute_simd_reduction_messages.cpp | 7 + test/OpenMP/for_reduction_messages.cpp | 8 + test/OpenMP/for_simd_reduction_messages.cpp | 8 + .../parallel_for_reduction_messages.cpp | 7 + .../parallel_for_simd_reduction_messages.cpp | 7 + test/OpenMP/parallel_reduction_messages.cpp | 7 + .../parallel_sections_reduction_messages.cpp | 9 + test/OpenMP/sections_reduction_messages.cpp | 10 + test/OpenMP/simd_reduction_messages.cpp | 7 + ...target_parallel_for_reduction_messages.cpp | 7 + ...t_parallel_for_simd_reduction_messages.cpp | 7 + .../target_parallel_reduction_messages.cpp | 7 + test/OpenMP/target_reduction_messages.cpp | 7 + .../OpenMP/target_simd_reduction_messages.cpp | 7 + ...ribute_parallel_for_reduction_messages.cpp | 7 + ...e_parallel_for_simd_reduction_messages.cpp | 7 + ...et_teams_distribute_reduction_messages.cpp | 7 + ...ams_distribute_simd_reduction_messages.cpp | 7 + .../target_teams_reduction_messages.cpp | 7 + test/OpenMP/taskloop_reduction_messages.cpp | 7 + .../taskloop_simd_reduction_messages.cpp | 7 + ...ribute_parallel_for_reduction_messages.cpp | 8 + ...e_parallel_for_simd_reduction_messages.cpp | 8 + .../teams_distribute_reduction_messages.cpp | 8 + ...ams_distribute_simd_reduction_messages.cpp | 8 + test/OpenMP/teams_reduction_messages.cpp | 8 + 30 files changed, 383 insertions(+), 145 deletions(-) diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h index 9f886ccfbd..1d812c8a21 100644 --- a/include/clang/AST/OpenMPClause.h +++ b/include/clang/AST/OpenMPClause.h @@ -2618,10 +2618,12 @@ public: } child_range used_children() { - return child_range(child_iterator(), child_iterator()); + return child_range(reinterpret_cast(varlist_begin()), + reinterpret_cast(varlist_end())); } const_child_range used_children() const { - return const_child_range(const_child_iterator(), const_child_iterator()); + auto Children = const_cast(this)->used_children(); + return const_child_range(Children.begin(), Children.end()); } static bool classof(const OMPClause *T) { diff --git a/test/Analysis/cfg-openmp.cpp b/test/Analysis/cfg-openmp.cpp index 9e2476eda1..c9730fa021 100644 --- a/test/Analysis/cfg-openmp.cpp +++ b/test/Analysis/cfg-openmp.cpp @@ -6,7 +6,8 @@ void xxx(int argc) { // CHECK-NEXT: 1: int x; // CHECK-NEXT: 2: int cond; // CHECK-NEXT: 3: int fp; - int x, cond, fp; +// CHECK-NEXT: 4: int rd; + int x, cond, fp, rd; // CHECK-NEXT: [[#ATOM:]]: x // CHECK-NEXT: [[#ATOM+1]]: [B1.[[#ATOM]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#ATOM+2]]: argc @@ -31,10 +32,11 @@ void xxx(int argc) { // CHECK-NEXT: [[#DPF+5]]: [B1.[[#DPF+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#DPF+6]]: [B1.[[#DPF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#DPF+7]]: fp -// CHECK-NEXT: [[#DPF+8]]: #pragma omp distribute parallel for if(parallel: cond) firstprivate(fp) +// CHECK-NEXT: [[#DPF+8]]: rd +// CHECK-NEXT: [[#DPF+9]]: #pragma omp distribute parallel for if(parallel: cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#DPF+3]]]; -#pragma omp distribute parallel for if(parallel:cond) firstprivate(fp) +#pragma omp distribute parallel for if(parallel:cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#DPFS:]]: x @@ -45,10 +47,11 @@ void xxx(int argc) { // CHECK-NEXT: [[#DPFS+5]]: [B1.[[#DPFS+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#DPFS+6]]: [B1.[[#DPFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#DPFS+7]]: fp -// CHECK-NEXT: [[#DPFS+8]]: #pragma omp distribute parallel for simd if(cond) firstprivate(fp) +// CHECK-NEXT: [[#DPFS+8]]: rd +// CHECK-NEXT: [[#DPFS+9]]: #pragma omp distribute parallel for simd if(cond) firstprivate(fp) reduction(-: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#DPFS+3]]]; -#pragma omp distribute parallel for simd if(cond) firstprivate(fp) +#pragma omp distribute parallel for simd if(cond) firstprivate(fp) reduction(-:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#DS:]]: x @@ -111,10 +114,11 @@ void xxx(int argc) { // CHECK-NEXT: [[#PF+5]]: [B1.[[#PF+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#PF+6]]: [B1.[[#PF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#PF+7]]: fp -// CHECK-NEXT: [[#PF+8]]: #pragma omp parallel for if(cond) firstprivate(fp) +// CHECK-NEXT: [[#PF+8]]: rd +// CHECK-NEXT: [[#PF+9]]: #pragma omp parallel for if(cond) firstprivate(fp) reduction(&: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#PF+3]]]; -#pragma omp parallel for if(cond) firstprivate(fp) +#pragma omp parallel for if(cond) firstprivate(fp) reduction(&:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#PFS:]]: x @@ -125,10 +129,11 @@ void xxx(int argc) { // CHECK-NEXT: [[#PFS+5]]: [B1.[[#PFS+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#PFS+6]]: [B1.[[#PFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#PFS+7]]: fp -// CHECK-NEXT: [[#PFS+8]]: #pragma omp parallel for simd if(cond) firstprivate(fp) +// CHECK-NEXT: [[#PFS+8]]: rd +// CHECK-NEXT: [[#PFS+9]]: #pragma omp parallel for simd if(cond) firstprivate(fp) reduction(|: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#PFS+3]]]; -#pragma omp parallel for simd if(cond) firstprivate(fp) +#pragma omp parallel for simd if(cond) firstprivate(fp) reduction(|:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#PAR:]]: x @@ -139,9 +144,10 @@ void xxx(int argc) { // CHECK-NEXT: [[#PAR+5]]: [B1.[[#PAR+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#PAR+6]]: [B1.[[#PAR+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#PAR+7]]: fp -// CHECK-NEXT: [[#PAR+8]]: #pragma omp parallel if(cond) firstprivate(fp) +// CHECK-NEXT: [[#PAR+8]]: rd +// CHECK-NEXT: [[#PAR+9]]: #pragma omp parallel if(cond) firstprivate(fp) reduction(min: rd) // CHECK-NEXT: [B1.[[#PAR+3]]]; -#pragma omp parallel if(cond) firstprivate(fp) +#pragma omp parallel if(cond) firstprivate(fp) reduction(min:rd) argc = x; // CHECK-NEXT: [[#PSECT:]]: x // CHECK-NEXT: [[#PSECT+1]]: [B1.[[#PSECT]]] (ImplicitCastExpr, LValueToRValue, int) @@ -151,11 +157,12 @@ void xxx(int argc) { // CHECK-NEXT: [[#PSECT+5]]: [B1.[[#PSECT+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#PSECT+6]]: [B1.[[#PSECT+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#PSECT+7]]: fp -// CHECK-NEXT: [[#PSECT+8]]: #pragma omp parallel sections if(cond) firstprivate(fp) +// CHECK-NEXT: [[#PSECT+8]]: rd +// CHECK-NEXT: [[#PSECT+9]]: #pragma omp parallel sections if(cond) firstprivate(fp) reduction(&&: rd) // CHECK-NEXT: { // CHECK-NEXT: [B1.[[#PSECT+3]]]; // CHECK-NEXT: } -#pragma omp parallel sections if(cond) firstprivate(fp) +#pragma omp parallel sections if(cond) firstprivate(fp) reduction(&&:rd) { argc = x; } @@ -178,169 +185,179 @@ void xxx(int argc) { #pragma omp single argc = x; // CHECK-NEXT: [[#TARGET:]]: -// CHECK-SAME: [B1.[[#TARGET+9]]] -// CHECK-NEXT: [[#TARGET+1]]: [B1.[[#TARGET+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TARGET+2]]: [B1.[[#TARGET+8]]] -// CHECK-NEXT: [[#TARGET+3]]: [B1.[[#TARGET+8]]] = [B1.[[#TARGET+1]]] +// CHECK-SAME: [B1.[[#TARGET+10]]] +// CHECK-NEXT: [[#TARGET+1]]: [B1.[[#TARGET+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TARGET+2]]: [B1.[[#TARGET+9]]] +// CHECK-NEXT: [[#TARGET+3]]: [B1.[[#TARGET+9]]] = [B1.[[#TARGET+1]]] // CHECK-NEXT: [[#TARGET+4]]: cond // CHECK-NEXT: [[#TARGET+5]]: [B1.[[#TARGET+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TARGET+6]]: [B1.[[#TARGET+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TARGET+7]]: fp -// CHECK-NEXT: [[#TARGET+8]]: argc -// CHECK-NEXT: [[#TARGET+9]]: x -// CHECK-NEXT: [[#TARGET+10]]: #pragma omp target depend(in : argc) if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TARGET+8]]: rd +// CHECK-NEXT: [[#TARGET+9]]: argc +// CHECK-NEXT: [[#TARGET+10]]: x +// CHECK-NEXT: [[#TARGET+11]]: #pragma omp target depend(in : argc) if(cond) firstprivate(fp) reduction(-: rd) // CHECK-NEXT: [B1.[[#TARGET+3]]]; #pragma omp target depend(in \ - : argc) if(cond) firstprivate(fp) + : argc) if(cond) firstprivate(fp) reduction(-:rd) argc = x; // CHECK-NEXT: [[#TPF:]]: -// CHECK-SAME: [B1.[[#TPF+9]]] -// CHECK-NEXT: [[#TPF+1]]: [B1.[[#TPF+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TPF+2]]: [B1.[[#TPF+8]]] -// CHECK-NEXT: [[#TPF+3]]: [B1.[[#TPF+8]]] = [B1.[[#TPF+1]]] +// CHECK-SAME: [B1.[[#TPF+10]]] +// CHECK-NEXT: [[#TPF+1]]: [B1.[[#TPF+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TPF+2]]: [B1.[[#TPF+9]]] +// CHECK-NEXT: [[#TPF+3]]: [B1.[[#TPF+9]]] = [B1.[[#TPF+1]]] // CHECK-NEXT: [[#TPF+4]]: cond // CHECK-NEXT: [[#TPF+5]]: [B1.[[#TPF+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TPF+6]]: [B1.[[#TPF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TPF+7]]: fp -// CHECK-NEXT: [[#TPF+8]]: argc -// CHECK-NEXT: [[#TPF+9]]: x -// CHECK-NEXT: [[#TPF+10]]: #pragma omp target parallel for if(parallel: cond) firstprivate(fp) +// CHECK-NEXT: [[#TPF+8]]: rd +// CHECK-NEXT: [[#TPF+9]]: argc +// CHECK-NEXT: [[#TPF+10]]: x +// CHECK-NEXT: [[#TPF+11]]: #pragma omp target parallel for if(parallel: cond) firstprivate(fp) reduction(max: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TPF+3]]]; -#pragma omp target parallel for if(parallel:cond) firstprivate(fp) +#pragma omp target parallel for if(parallel:cond) firstprivate(fp) reduction(max:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TPFS:]]: -// CHECK-SAME: [B1.[[#TPFS+9]]] -// CHECK-NEXT: [[#TPFS+1]]: [B1.[[#TPFS+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TPFS+2]]: [B1.[[#TPFS+8]]] -// CHECK-NEXT: [[#TPFS+3]]: [B1.[[#TPFS+8]]] = [B1.[[#TPFS+1]]] +// CHECK-SAME: [B1.[[#TPFS+10]]] +// CHECK-NEXT: [[#TPFS+1]]: [B1.[[#TPFS+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TPFS+2]]: [B1.[[#TPFS+9]]] +// CHECK-NEXT: [[#TPFS+3]]: [B1.[[#TPFS+9]]] = [B1.[[#TPFS+1]]] // CHECK-NEXT: [[#TPFS+4]]: cond // CHECK-NEXT: [[#TPFS+5]]: [B1.[[#TPFS+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TPFS+6]]: [B1.[[#TPFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TPFS+7]]: fp -// CHECK-NEXT: [[#TPFS+8]]: argc -// CHECK-NEXT: [[#TPFS+9]]: x -// CHECK-NEXT: [[#TPFS+10]]: #pragma omp target parallel for simd if(target: cond) firstprivate(fp) +// CHECK-NEXT: [[#TPFS+8]]: rd +// CHECK-NEXT: [[#TPFS+9]]: argc +// CHECK-NEXT: [[#TPFS+10]]: x +// CHECK-NEXT: [[#TPFS+11]]: #pragma omp target parallel for simd if(target: cond) firstprivate(fp) reduction(*: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TPFS+3]]]; -#pragma omp target parallel for simd if(target:cond) firstprivate(fp) +#pragma omp target parallel for simd if(target:cond) firstprivate(fp) reduction(*:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TP:]]: -// CHECK-SAME: [B1.[[#TP+9]]] -// CHECK-NEXT: [[#TP+1]]: [B1.[[#TP+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TP+2]]: [B1.[[#TP+8]]] -// CHECK-NEXT: [[#TP+3]]: [B1.[[#TP+8]]] = [B1.[[#TP+1]]] +// CHECK-SAME: [B1.[[#TP+10]]] +// CHECK-NEXT: [[#TP+1]]: [B1.[[#TP+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TP+2]]: [B1.[[#TP+9]]] +// CHECK-NEXT: [[#TP+3]]: [B1.[[#TP+9]]] = [B1.[[#TP+1]]] // CHECK-NEXT: [[#TP+4]]: cond // CHECK-NEXT: [[#TP+5]]: [B1.[[#TP+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TP+6]]: [B1.[[#TP+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TP+7]]: fp -// CHECK-NEXT: [[#TP+8]]: argc -// CHECK-NEXT: [[#TP+9]]: x -// CHECK-NEXT: [[#TP+10]]: #pragma omp target parallel if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TP+8]]: rd +// CHECK-NEXT: [[#TP+9]]: argc +// CHECK-NEXT: [[#TP+10]]: x +// CHECK-NEXT: [[#TP+11]]: #pragma omp target parallel if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: [B1.[[#TP+3]]]; -#pragma omp target parallel if(cond) firstprivate(fp) +#pragma omp target parallel if(cond) firstprivate(fp) reduction(+:rd) argc = x; // CHECK-NEXT: [[#TSIMD:]]: -// CHECK-SAME: [B1.[[#TSIMD+9]]] -// CHECK-NEXT: [[#TSIMD+1]]: [B1.[[#TSIMD+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TSIMD+2]]: [B1.[[#TSIMD+8]]] -// CHECK-NEXT: [[#TSIMD+3]]: [B1.[[#TSIMD+8]]] = [B1.[[#TSIMD+1]]] +// CHECK-SAME: [B1.[[#TSIMD+10]]] +// CHECK-NEXT: [[#TSIMD+1]]: [B1.[[#TSIMD+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TSIMD+2]]: [B1.[[#TSIMD+9]]] +// CHECK-NEXT: [[#TSIMD+3]]: [B1.[[#TSIMD+9]]] = [B1.[[#TSIMD+1]]] // CHECK-NEXT: [[#TSIMD+4]]: cond // CHECK-NEXT: [[#TSIMD+5]]: [B1.[[#TSIMD+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TSIMD+6]]: [B1.[[#TSIMD+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TSIMD+7]]: fp -// CHECK-NEXT: [[#TSIMD+8]]: argc -// CHECK-NEXT: [[#TSIMD+9]]: x -// CHECK-NEXT: [[#TSIMD+10]]: #pragma omp target simd if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TSIMD+8]]: rd +// CHECK-NEXT: [[#TSIMD+9]]: argc +// CHECK-NEXT: [[#TSIMD+10]]: x +// CHECK-NEXT: [[#TSIMD+11]]: #pragma omp target simd if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TSIMD+3]]]; -#pragma omp target simd if(cond) firstprivate(fp) +#pragma omp target simd if(cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TTD:]]: -// CHECK-SAME: [B1.[[#TTD+9]]] -// CHECK-NEXT: [[#TTD+1]]: [B1.[[#TTD+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TTD+2]]: [B1.[[#TTD+8]]] -// CHECK-NEXT: [[#TTD+3]]: [B1.[[#TTD+8]]] = [B1.[[#TTD+1]]] +// CHECK-SAME: [B1.[[#TTD+10]]] +// CHECK-NEXT: [[#TTD+1]]: [B1.[[#TTD+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TTD+2]]: [B1.[[#TTD+9]]] +// CHECK-NEXT: [[#TTD+3]]: [B1.[[#TTD+9]]] = [B1.[[#TTD+1]]] // CHECK-NEXT: [[#TTD+4]]: cond // CHECK-NEXT: [[#TTD+5]]: [B1.[[#TTD+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TTD+6]]: [B1.[[#TTD+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TTD+7]]: fp -// CHECK-NEXT: [[#TTD+8]]: argc -// CHECK-NEXT: [[#TTD+9]]: x -// CHECK-NEXT: [[#TTD+10]]: #pragma omp target teams distribute if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TTD+8]]: rd +// CHECK-NEXT: [[#TTD+9]]: argc +// CHECK-NEXT: [[#TTD+10]]: x +// CHECK-NEXT: [[#TTD+11]]: #pragma omp target teams distribute if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TTD+3]]]; -#pragma omp target teams distribute if(cond) firstprivate(fp) +#pragma omp target teams distribute if(cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TTDPF:]]: -// CHECK-SAME: [B1.[[#TTDPF+9]]] -// CHECK-NEXT: [[#TTDPF+1]]: [B1.[[#TTDPF+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TTDPF+2]]: [B1.[[#TTDPF+8]]] -// CHECK-NEXT: [[#TTDPF+3]]: [B1.[[#TTDPF+8]]] = [B1.[[#TTDPF+1]]] +// CHECK-SAME: [B1.[[#TTDPF+10]]] +// CHECK-NEXT: [[#TTDPF+1]]: [B1.[[#TTDPF+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TTDPF+2]]: [B1.[[#TTDPF+9]]] +// CHECK-NEXT: [[#TTDPF+3]]: [B1.[[#TTDPF+9]]] = [B1.[[#TTDPF+1]]] // CHECK-NEXT: [[#TTDPF+4]]: cond // CHECK-NEXT: [[#TTDPF+5]]: [B1.[[#TTDPF+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TTDPF+6]]: [B1.[[#TTDPF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TTDPF+7]]: fp -// CHECK-NEXT: [[#TTDPF+8]]: argc -// CHECK-NEXT: [[#TTDPF+9]]: x -// CHECK-NEXT: [[#TTDPF+10]]: #pragma omp target teams distribute parallel for if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TTDPF+8]]: rd +// CHECK-NEXT: [[#TTDPF+9]]: argc +// CHECK-NEXT: [[#TTDPF+10]]: x +// CHECK-NEXT: [[#TTDPF+11]]: #pragma omp target teams distribute parallel for if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TTDPF+3]]]; -#pragma omp target teams distribute parallel for if(cond) firstprivate(fp) +#pragma omp target teams distribute parallel for if(cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TTDPFS:]]: -// CHECK-SAME: [B1.[[#TTDPFS+9]]] -// CHECK-NEXT: [[#TTDPFS+1]]: [B1.[[#TTDPFS+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TTDPFS+2]]: [B1.[[#TTDPFS+8]]] -// CHECK-NEXT: [[#TTDPFS+3]]: [B1.[[#TTDPFS+8]]] = [B1.[[#TTDPFS+1]]] +// CHECK-SAME: [B1.[[#TTDPFS+10]]] +// CHECK-NEXT: [[#TTDPFS+1]]: [B1.[[#TTDPFS+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TTDPFS+2]]: [B1.[[#TTDPFS+9]]] +// CHECK-NEXT: [[#TTDPFS+3]]: [B1.[[#TTDPFS+9]]] = [B1.[[#TTDPFS+1]]] // CHECK-NEXT: [[#TTDPFS+4]]: cond // CHECK-NEXT: [[#TTDPFS+5]]: [B1.[[#TTDPFS+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TTDPFS+6]]: [B1.[[#TTDPFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TTDPFS+7]]: fp -// CHECK-NEXT: [[#TTDPFS+8]]: argc -// CHECK-NEXT: [[#TTDPFS+9]]: x -// CHECK-NEXT: [[#TTDPFS+10]]: #pragma omp target teams distribute parallel for simd if(parallel: cond) firstprivate(fp) +// CHECK-NEXT: [[#TTDPFS+8]]: rd +// CHECK-NEXT: [[#TTDPFS+9]]: argc +// CHECK-NEXT: [[#TTDPFS+10]]: x +// CHECK-NEXT: [[#TTDPFS+11]]: #pragma omp target teams distribute parallel for simd if(parallel: cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TTDPFS+3]]]; -#pragma omp target teams distribute parallel for simd if(parallel:cond) firstprivate(fp) +#pragma omp target teams distribute parallel for simd if(parallel:cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TTDS:]]: -// CHECK-SAME: [B1.[[#TTDS+9]]] -// CHECK-NEXT: [[#TTDS+1]]: [B1.[[#TTDS+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TTDS+2]]: [B1.[[#TTDS+8]]] -// CHECK-NEXT: [[#TTDS+3]]: [B1.[[#TTDS+8]]] = [B1.[[#TTDS+1]]] +// CHECK-SAME: [B1.[[#TTDS+10]]] +// CHECK-NEXT: [[#TTDS+1]]: [B1.[[#TTDS+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TTDS+2]]: [B1.[[#TTDS+9]]] +// CHECK-NEXT: [[#TTDS+3]]: [B1.[[#TTDS+9]]] = [B1.[[#TTDS+1]]] // CHECK-NEXT: [[#TTDS+4]]: cond // CHECK-NEXT: [[#TTDS+5]]: [B1.[[#TTDS+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TTDS+6]]: [B1.[[#TTDS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TTDS+7]]: fp -// CHECK-NEXT: [[#TTDS+8]]: argc -// CHECK-NEXT: [[#TTDS+9]]: x -// CHECK-NEXT: [[#TTDS+10]]: #pragma omp target teams distribute simd if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TTDS+8]]: rd +// CHECK-NEXT: [[#TTDS+9]]: argc +// CHECK-NEXT: [[#TTDS+10]]: x +// CHECK-NEXT: [[#TTDS+11]]: #pragma omp target teams distribute simd if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TTDS+3]]]; -#pragma omp target teams distribute simd if(cond) firstprivate(fp) +#pragma omp target teams distribute simd if(cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TT:]]: -// CHECK-SAME: [B1.[[#TT+9]]] -// CHECK-NEXT: [[#TT+1]]: [B1.[[#TT+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TT+2]]: [B1.[[#TT+8]]] -// CHECK-NEXT: [[#TT+3]]: [B1.[[#TT+8]]] = [B1.[[#TT+1]]] +// CHECK-SAME: [B1.[[#TT+10]]] +// CHECK-NEXT: [[#TT+1]]: [B1.[[#TT+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TT+2]]: [B1.[[#TT+9]]] +// CHECK-NEXT: [[#TT+3]]: [B1.[[#TT+9]]] = [B1.[[#TT+1]]] // CHECK-NEXT: [[#TT+4]]: cond // CHECK-NEXT: [[#TT+5]]: [B1.[[#TT+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TT+6]]: [B1.[[#TT+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TT+7]]: fp -// CHECK-NEXT: [[#TT+8]]: argc -// CHECK-NEXT: [[#TT+9]]: x -// CHECK-NEXT: [[#TT+10]]: #pragma omp target teams if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TT+8]]: rd +// CHECK-NEXT: [[#TT+9]]: argc +// CHECK-NEXT: [[#TT+10]]: x +// CHECK-NEXT: [[#TT+11]]: #pragma omp target teams if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: [B1.[[#TT+3]]]; -#pragma omp target teams if(cond) firstprivate(fp) +#pragma omp target teams if(cond) firstprivate(fp) reduction(+:rd) argc = x; // CHECK-NEXT: [[#TU:]]: cond // CHECK-NEXT: [[#TU+1]]: [B1.[[#TU]]] (ImplicitCastExpr, LValueToRValue, int) @@ -371,37 +388,39 @@ void xxx(int argc) { #pragma omp taskgroup argc = x; // CHECK-NEXT: [[#TL:]]: -// CHECK-SAME: [B1.[[#TL+9]]] -// CHECK-NEXT: [[#TL+1]]: [B1.[[#TL+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TL+2]]: [B1.[[#TL+8]]] -// CHECK-NEXT: [[#TL+3]]: [B1.[[#TL+8]]] = [B1.[[#TL+1]]] +// CHECK-SAME: [B1.[[#TL+10]]] +// CHECK-NEXT: [[#TL+1]]: [B1.[[#TL+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TL+2]]: [B1.[[#TL+9]]] +// CHECK-NEXT: [[#TL+3]]: [B1.[[#TL+9]]] = [B1.[[#TL+1]]] // CHECK-NEXT: [[#TL+4]]: cond // CHECK-NEXT: [[#TL+5]]: [B1.[[#TL+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TL+6]]: [B1.[[#TL+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TL+7]]: fp -// CHECK-NEXT: [[#TL+8]]: argc -// CHECK-NEXT: [[#TL+9]]: x -// CHECK-NEXT: [[#TL+10]]: #pragma omp taskloop if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TL+8]]: rd +// CHECK-NEXT: [[#TL+9]]: argc +// CHECK-NEXT: [[#TL+10]]: x +// CHECK-NEXT: [[#TL+11]]: #pragma omp taskloop if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TL+3]]]; -#pragma omp taskloop if(cond) firstprivate(fp) +#pragma omp taskloop if(cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TLS:]]: -// CHECK-SAME: [B1.[[#TLS+9]]] -// CHECK-NEXT: [[#TLS+1]]: [B1.[[#TLS+9]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TLS+2]]: [B1.[[#TLS+8]]] -// CHECK-NEXT: [[#TLS+3]]: [B1.[[#TLS+8]]] = [B1.[[#TLS+1]]] +// CHECK-SAME: [B1.[[#TLS+10]]] +// CHECK-NEXT: [[#TLS+1]]: [B1.[[#TLS+10]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TLS+2]]: [B1.[[#TLS+9]]] +// CHECK-NEXT: [[#TLS+3]]: [B1.[[#TLS+9]]] = [B1.[[#TLS+1]]] // CHECK-NEXT: [[#TLS+4]]: cond // CHECK-NEXT: [[#TLS+5]]: [B1.[[#TLS+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TLS+6]]: [B1.[[#TLS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) // CHECK-NEXT: [[#TLS+7]]: fp -// CHECK-NEXT: [[#TLS+8]]: argc -// CHECK-NEXT: [[#TLS+9]]: x -// CHECK-NEXT: [[#TLS+10]]: #pragma omp taskloop simd if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TLS+8]]: rd +// CHECK-NEXT: [[#TLS+9]]: argc +// CHECK-NEXT: [[#TLS+10]]: x +// CHECK-NEXT: [[#TLS+11]]: #pragma omp taskloop simd if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TLS+3]]]; -#pragma omp taskloop simd if(cond) firstprivate(fp) +#pragma omp taskloop simd if(cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TDPF:]]: x @@ -411,69 +430,77 @@ void xxx(int argc) { // CHECK-NEXT: [[#TDPF+4]]: cond // CHECK-NEXT: [[#TDPF+5]]: [B1.[[#TDPF+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TDPF+6]]: [B1.[[#TDPF+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) -// CHECK-NEXT: [[#TDPF+7]]: [B1.[[#TDPF+9]]] -// CHECK-NEXT: [[#TDPF+8]]: #pragma omp teams distribute parallel for if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TDPF+7]]: [B1.[[#TDPF+10]]] +// CHECK-NEXT: [[#TDPF+8]]: [B1.[[#TDPF+11]]] +// CHECK-NEXT: [[#TDPF+9]]: #pragma omp teams distribute parallel for if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TDPF+3]]]; -// CHECK-NEXT: [[#TDPF+9]]: fp -// CHECK-NEXT: [[#TDPF+10]]: argc -// CHECK-NEXT: [[#TDPF+11]]: x -// CHECK-NEXT: [[#TDPF+12]]: cond -// CHECK-NEXT: [[#TDPF+13]]: #pragma omp target +// CHECK-NEXT: [[#TDPF+10]]: fp +// CHECK-NEXT: [[#TDPF+11]]: rd +// CHECK-NEXT: [[#TDPF+12]]: argc +// CHECK-NEXT: [[#TDPF+13]]: x +// CHECK-NEXT: [[#TDPF+14]]: cond +// CHECK-NEXT: [[#TDPF+15]]: #pragma omp target #pragma omp target -#pragma omp teams distribute parallel for if(cond) firstprivate(fp) +#pragma omp teams distribute parallel for if(cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; -// CHECK-NEXT: [B1.[[#TDPF+8]]] [[#TDPFS:]]: x +// CHECK-NEXT: [B1.[[#TDPF+9]]] [[#TDPFS:]]: x // CHECK-NEXT: [[#TDPFS+1]]: [B1.[[#TDPFS]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TDPFS+2]]: argc // CHECK-NEXT: [[#TDPFS+3]]: [B1.[[#TDPFS+2]]] = [B1.[[#TDPFS+1]]] // CHECK-NEXT: [[#TDPFS+4]]: cond // CHECK-NEXT: [[#TDPFS+5]]: [B1.[[#TDPFS+4]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TDPFS+6]]: [B1.[[#TDPFS+5]]] (ImplicitCastExpr, IntegralToBoolean, _Bool) -// CHECK-NEXT: [[#TDPFS+7]]: [B1.[[#TDPFS+9]]] -// CHECK-NEXT: [[#TDPFS+8]]: #pragma omp teams distribute parallel for simd if(cond) firstprivate(fp) +// CHECK-NEXT: [[#TDPFS+7]]: [B1.[[#TDPFS+10]]] +// CHECK-NEXT: [[#TDPFS+8]]: [B1.[[#TDPFS+11]]] +// CHECK-NEXT: [[#TDPFS+9]]: #pragma omp teams distribute parallel for simd if(cond) firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TDPFS+3]]]; -// CHECK-NEXT: [[#TDPFS+9]]: fp -// CHECK-NEXT: [[#TDPFS+10]]: argc -// CHECK-NEXT: [[#TDPFS+11]]: x -// CHECK-NEXT: [[#TDPFS+12]]: cond -// CHECK-NEXT: [[#TDPFS+13]]: #pragma omp target +// CHECK-NEXT: [[#TDPFS+10]]: fp +// CHECK-NEXT: [[#TDPFS+11]]: rd +// CHECK-NEXT: [[#TDPFS+12]]: argc +// CHECK-NEXT: [[#TDPFS+13]]: x +// CHECK-NEXT: [[#TDPFS+14]]: cond +// CHECK-NEXT: [[#TDPFS+15]]: #pragma omp target #pragma omp target -#pragma omp teams distribute parallel for simd if(cond) firstprivate(fp) +#pragma omp teams distribute parallel for simd if(cond) firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; -// CHECK-NEXT: [B1.[[#TDPFS+8]]] [[#TDS:]]: x +// CHECK-NEXT: [B1.[[#TDPFS+9]]] [[#TDS:]]: x // CHECK-NEXT: [[#TDS+1]]: [B1.[[#TDS]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TDS+2]]: argc // CHECK-NEXT: [[#TDS+3]]: [B1.[[#TDS+2]]] = [B1.[[#TDS+1]]] -// CHECK-NEXT: [[#TDS+4]]: [B1.[[#TDS+6]]] -// CHECK-NEXT: [[#TDS+5]]: #pragma omp teams distribute simd firstprivate(fp) +// CHECK-NEXT: [[#TDS+4]]: [B1.[[#TDS+7]]] +// CHECK-NEXT: [[#TDS+5]]: [B1.[[#TDS+8]]] +// CHECK-NEXT: [[#TDS+6]]: #pragma omp teams distribute simd firstprivate(fp) reduction(+: rd) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TDS+3]]]; -// CHECK-NEXT: [[#TDS+6]]: fp -// CHECK-NEXT: [[#TDS+7]]: argc -// CHECK-NEXT: [[#TDS+8]]: x -// CHECK-NEXT: [[#TDS+9]]: #pragma omp target +// CHECK-NEXT: [[#TDS+7]]: fp +// CHECK-NEXT: [[#TDS+8]]: rd +// CHECK-NEXT: [[#TDS+9]]: argc +// CHECK-NEXT: [[#TDS+10]]: x +// CHECK-NEXT: [[#TDS+11]]: #pragma omp target #pragma omp target -#pragma omp teams distribute simd firstprivate(fp) +#pragma omp teams distribute simd firstprivate(fp) reduction(+:rd) for (int i = 0; i < 10; ++i) argc = x; -// CHECK-NEXT: [B1.[[#TDS+5]]] [[#TEAMS:]]: x +// CHECK-NEXT: [B1.[[#TDS+6]]] [[#TEAMS:]]: x // CHECK-NEXT: [[#TEAMS+1]]: [B1.[[#TEAMS]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TEAMS+2]]: argc // CHECK-NEXT: [[#TEAMS+3]]: [B1.[[#TEAMS+2]]] = [B1.[[#TEAMS+1]]] -// CHECK-NEXT: [[#TEAMS+4]]: [B1.[[#TEAMS+6]]] -// CHECK-NEXT: [[#TEAMS+5]]: #pragma omp teams firstprivate(fp) +// CHECK-NEXT: [[#TEAMS+4]]: [B1.[[#TEAMS+7]]] +// CHECK-NEXT: [[#TEAMS+5]]: [B1.[[#TEAMS+8]]] +// CHECK-NEXT: [[#TEAMS+6]]: #pragma omp teams firstprivate(fp) reduction(+: rd) // CHECK-NEXT: [B1.[[#TEAMS+3]]]; -// CHECK-NEXT: [[#TEAMS+6]]: fp -// CHECK-NEXT: [[#TEAMS+7]]: argc -// CHECK-NEXT: [[#TEAMS+8]]: x -// CHECK-NEXT: [[#TEAMS+9]]: #pragma omp target +// CHECK-NEXT: [[#TEAMS+7]]: fp +// CHECK-NEXT: [[#TEAMS+8]]: rd +// CHECK-NEXT: [[#TEAMS+9]]: argc +// CHECK-NEXT: [[#TEAMS+10]]: x +// CHECK-NEXT: [[#TEAMS+11]]: #pragma omp target #pragma omp target -#pragma omp teams firstprivate(fp) +#pragma omp teams firstprivate(fp) reduction(+:rd) argc = x; -// CHECK-NEXT: [B1.[[#TEAMS+5]]] Preds +// CHECK-NEXT: [B1.[[#TEAMS+6]]] Preds } diff --git a/test/OpenMP/distribute_parallel_for_reduction_messages.cpp b/test/OpenMP/distribute_parallel_for_reduction_messages.cpp index 75b4112fee..eb9d740d77 100644 --- a/test/OpenMP/distribute_parallel_for_reduction_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_reduction_messages.cpp @@ -7,6 +7,14 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized extern int omp_default_mem_alloc; + +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp distribute parallel for reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp b/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp index 0b27fe25e4..98fdf1ffc6 100644 --- a/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/distribute_parallel_for_simd_reduction_messages.cpp @@ -7,6 +7,13 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wno-openmp-target -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp distribute parallel for simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/distribute_simd_reduction_messages.cpp b/test/OpenMP/distribute_simd_reduction_messages.cpp index 4486877025..82ea20fe47 100644 --- a/test/OpenMP/distribute_simd_reduction_messages.cpp +++ b/test/OpenMP/distribute_simd_reduction_messages.cpp @@ -7,6 +7,13 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp distribute simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/for_reduction_messages.cpp b/test/OpenMP/for_reduction_messages.cpp index a082e5843e..1ba3a604c6 100644 --- a/test/OpenMP/for_reduction_messages.cpp +++ b/test/OpenMP/for_reduction_messages.cpp @@ -7,6 +7,14 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp parallel +#pragma omp for reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/for_simd_reduction_messages.cpp b/test/OpenMP/for_simd_reduction_messages.cpp index 9a112bc2c5..c7396084f3 100644 --- a/test/OpenMP/for_simd_reduction_messages.cpp +++ b/test/OpenMP/for_simd_reduction_messages.cpp @@ -7,6 +7,14 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp parallel +#pragma omp for simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/parallel_for_reduction_messages.cpp b/test/OpenMP/parallel_for_reduction_messages.cpp index 8035767517..b28fe6c379 100644 --- a/test/OpenMP/parallel_for_reduction_messages.cpp +++ b/test/OpenMP/parallel_for_reduction_messages.cpp @@ -7,6 +7,13 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp parallel for reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/parallel_for_simd_reduction_messages.cpp b/test/OpenMP/parallel_for_simd_reduction_messages.cpp index 4c2e5978b2..d8c13e7d2c 100644 --- a/test/OpenMP/parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/parallel_for_simd_reduction_messages.cpp @@ -7,6 +7,13 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -o - %s -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp parallel for simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/parallel_reduction_messages.cpp b/test/OpenMP/parallel_reduction_messages.cpp index cb0ba7cf71..881615684c 100644 --- a/test/OpenMP/parallel_reduction_messages.cpp +++ b/test/OpenMP/parallel_reduction_messages.cpp @@ -7,6 +7,13 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp parallel reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/parallel_sections_reduction_messages.cpp b/test/OpenMP/parallel_sections_reduction_messages.cpp index 72aa9d4dde..6b4f5f9415 100644 --- a/test/OpenMP/parallel_sections_reduction_messages.cpp +++ b/test/OpenMP/parallel_sections_reduction_messages.cpp @@ -7,6 +7,15 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp parallel sections reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} +{ + for (int i = 0; i < 10; ++i) + ; +} +} + void foo() { } diff --git a/test/OpenMP/sections_reduction_messages.cpp b/test/OpenMP/sections_reduction_messages.cpp index 8b1c1f1abb..40e43d23d8 100644 --- a/test/OpenMP/sections_reduction_messages.cpp +++ b/test/OpenMP/sections_reduction_messages.cpp @@ -7,6 +7,16 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -ferror-limit 150 -o - %s -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp parallel +#pragma omp sections reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + { + for (int i = 0; i < 10; ++i) + ; + } +} + void foo() { } diff --git a/test/OpenMP/simd_reduction_messages.cpp b/test/OpenMP/simd_reduction_messages.cpp index 8e2503331b..e065419fbc 100644 --- a/test/OpenMP/simd_reduction_messages.cpp +++ b/test/OpenMP/simd_reduction_messages.cpp @@ -7,6 +7,13 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_parallel_for_reduction_messages.cpp b/test/OpenMP/target_parallel_for_reduction_messages.cpp index 3666a34c95..101bef490e 100644 --- a/test/OpenMP/target_parallel_for_reduction_messages.cpp +++ b/test/OpenMP/target_parallel_for_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target parallel for reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp b/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp index 126518a58d..a755046d55 100644 --- a/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target parallel for simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_parallel_reduction_messages.cpp b/test/OpenMP/target_parallel_reduction_messages.cpp index 929d6af18c..ae72f89f4d 100644 --- a/test/OpenMP/target_parallel_reduction_messages.cpp +++ b/test/OpenMP/target_parallel_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target parallel reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_reduction_messages.cpp b/test/OpenMP/target_reduction_messages.cpp index 28c7c95723..7417cebca7 100644 --- a/test/OpenMP/target_reduction_messages.cpp +++ b/test/OpenMP/target_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_simd_reduction_messages.cpp b/test/OpenMP/target_simd_reduction_messages.cpp index 551099418d..57663ef838 100644 --- a/test/OpenMP/target_simd_reduction_messages.cpp +++ b/test/OpenMP/target_simd_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_teams_distribute_parallel_for_reduction_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_reduction_messages.cpp index 296c0b0f66..cfd0b73666 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_reduction_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target teams distribute parallel for reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp index 9336d94807..6d76945f42 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target teams distribute parallel for simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_teams_distribute_reduction_messages.cpp b/test/OpenMP/target_teams_distribute_reduction_messages.cpp index b0f30e2eef..26080557d0 100644 --- a/test/OpenMP/target_teams_distribute_reduction_messages.cpp +++ b/test/OpenMP/target_teams_distribute_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target teams distribute reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp b/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp index 84da687171..100f992fb6 100644 --- a/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target teams distribute simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/target_teams_reduction_messages.cpp b/test/OpenMP/target_teams_reduction_messages.cpp index 77684296fd..3da0cc8479 100644 --- a/test/OpenMP/target_teams_reduction_messages.cpp +++ b/test/OpenMP/target_teams_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target teams reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/taskloop_reduction_messages.cpp b/test/OpenMP/taskloop_reduction_messages.cpp index b7a0f2eb0d..da044ab2c9 100644 --- a/test/OpenMP/taskloop_reduction_messages.cpp +++ b/test/OpenMP/taskloop_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp taskloop reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/taskloop_simd_reduction_messages.cpp b/test/OpenMP/taskloop_simd_reduction_messages.cpp index 7ac4c2488c..82047f04cd 100644 --- a/test/OpenMP/taskloop_simd_reduction_messages.cpp +++ b/test/OpenMP/taskloop_simd_reduction_messages.cpp @@ -16,6 +16,13 @@ extern const omp_allocator_handle_t omp_cgroup_mem_alloc; extern const omp_allocator_handle_t omp_pteam_mem_alloc; extern const omp_allocator_handle_t omp_thread_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp taskloop simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp index beebe84e6d..b748b16382 100644 --- a/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_reduction_messages.cpp @@ -7,6 +7,14 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wno-openmp-target -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target +#pragma omp teams distribute parallel for simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp b/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp index feb31286b8..33a708c43e 100644 --- a/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_parallel_for_simd_reduction_messages.cpp @@ -7,6 +7,14 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wno-openmp-target -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target +#pragma omp teams distribute parallel for simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/teams_distribute_reduction_messages.cpp b/test/OpenMP/teams_distribute_reduction_messages.cpp index 9e1ed32fc3..2c65a2b921 100644 --- a/test/OpenMP/teams_distribute_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_reduction_messages.cpp @@ -7,6 +7,14 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wno-openmp-target -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target +#pragma omp teams distribute reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/teams_distribute_simd_reduction_messages.cpp b/test/OpenMP/teams_distribute_simd_reduction_messages.cpp index 56935ed8ac..3da6ac0f04 100644 --- a/test/OpenMP/teams_distribute_simd_reduction_messages.cpp +++ b/test/OpenMP/teams_distribute_simd_reduction_messages.cpp @@ -7,6 +7,14 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 %s -Wno-openmp-target -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target +#pragma omp teams distribute simd reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } diff --git a/test/OpenMP/teams_reduction_messages.cpp b/test/OpenMP/teams_reduction_messages.cpp index 73cce700de..a98a540ceb 100644 --- a/test/OpenMP/teams_reduction_messages.cpp +++ b/test/OpenMP/teams_reduction_messages.cpp @@ -7,6 +7,14 @@ // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -o - %s -Wno-openmp-target -Wuninitialized extern int omp_default_mem_alloc; +void xxx(int argc) { + int fp; // expected-note {{initialize the variable 'fp' to silence this warning}} +#pragma omp target +#pragma omp teams reduction(+:fp) // expected-warning {{variable 'fp' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + void foo() { } -- 2.50.1