From 0a86656de64e84cbe70985eb799d043a66e2e036 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Wed, 28 Aug 2019 14:55:08 +0000 Subject: [OPENMP][Analysis] Add analysis of the map clauses. Summary: Added basic analysis of map clauses. Only map clauses with to and tofrom map type must be analyzed since all other map types (alloc, delete, etc.) do not require to use the value of the initial variable, instead they create the new copy of the variable. Reviewers: NoQ Subscribers: guansong, cfe-commits, kkwli0, caomhin Tags: #clang Differential Revision: https://reviews.llvm.org/D66668 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@370214 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/clang/AST/OpenMPClause.h | 7 +- test/Analysis/cfg-openmp.cpp | 104 +++++++++++---------- test/OpenMP/target_data_messages.c | 7 ++ test/OpenMP/target_enter_data_map_messages.c | 7 ++ test/OpenMP/target_map_messages.cpp | 8 ++ test/OpenMP/target_parallel_for_map_messages.cpp | 7 ++ .../target_parallel_for_simd_map_messages.cpp | 7 ++ test/OpenMP/target_parallel_map_messages.cpp | 7 ++ test/OpenMP/target_simd_map_messages.cpp | 7 ++ .../target_teams_distribute_map_messages.cpp | 7 ++ ..._teams_distribute_parallel_for_map_messages.cpp | 7 ++ ...s_distribute_parallel_for_simd_map_messages.cpp | 7 ++ .../target_teams_distribute_simd_map_messages.cpp | 7 ++ test/OpenMP/target_teams_map_messages.cpp | 8 ++ 14 files changed, 147 insertions(+), 50 deletions(-) diff --git a/include/clang/AST/OpenMPClause.h b/include/clang/AST/OpenMPClause.h index bf2c6e2b68..6c504c7701 100644 --- a/include/clang/AST/OpenMPClause.h +++ b/include/clang/AST/OpenMPClause.h @@ -5025,12 +5025,17 @@ public: } child_range used_children() { + if (MapType == OMPC_MAP_to || MapType == OMPC_MAP_tofrom) + return child_range(reinterpret_cast(varlist_begin()), + reinterpret_cast(varlist_end())); return child_range(child_iterator(), child_iterator()); } 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) { return T->getClauseKind() == OMPC_map; } diff --git a/test/Analysis/cfg-openmp.cpp b/test/Analysis/cfg-openmp.cpp index b6fe4f2b81..6cae9663f4 100644 --- a/test/Analysis/cfg-openmp.cpp +++ b/test/Analysis/cfg-openmp.cpp @@ -9,7 +9,8 @@ void xxx(int argc) { // CHECK-NEXT: 4: int rd; // CHECK-NEXT: 5: int lin; // CHECK-NEXT: 6: int step; - int x, cond, fp, rd, lin, step; +// CHECK-NEXT: 7: int map; + int x, cond, fp, rd, lin, step, map; // CHECK-NEXT: [[#ATOM:]]: x // CHECK-NEXT: [[#ATOM+1]]: [B1.[[#ATOM]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#ATOM+2]]: argc @@ -219,10 +220,10 @@ void xxx(int argc) { : argc) if(cond) firstprivate(fp) reduction(-:rd) argc = x; // CHECK-NEXT: [[#TPF:]]: -// CHECK-SAME: [B1.[[#TPF+13]]] -// CHECK-NEXT: [[#TPF+1]]: [B1.[[#TPF+13]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TPF+2]]: [B1.[[#TPF+12]]] -// CHECK-NEXT: [[#TPF+3]]: [B1.[[#TPF+12]]] = [B1.[[#TPF+1]]] +// CHECK-SAME: [B1.[[#TPF+14]]] +// CHECK-NEXT: [[#TPF+1]]: [B1.[[#TPF+14]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TPF+2]]: [B1.[[#TPF+13]]] +// CHECK-NEXT: [[#TPF+3]]: [B1.[[#TPF+13]]] = [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) @@ -231,19 +232,20 @@ void xxx(int argc) { // CHECK-NEXT: [[#TPF+9]]: lin // CHECK-NEXT: [[#TPF+10]]: step // CHECK-NEXT: [[#TPF+11]]: [B1.[[#TPF+10]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TPF+12]]: argc -// CHECK-NEXT: [[#TPF+13]]: x -// CHECK-NEXT: [[#TPF+14]]: #pragma omp target parallel for if(parallel: cond) firstprivate(fp) reduction(max: rd) linear(lin: step) +// CHECK-NEXT: [[#TPF+12]]: map +// CHECK-NEXT: [[#TPF+13]]: argc +// CHECK-NEXT: [[#TPF+14]]: x +// CHECK-NEXT: [[#TPF+15]]: #pragma omp target parallel for if(parallel: cond) firstprivate(fp) reduction(max: rd) linear(lin: step) map(tofrom: map) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TPF+3]]]; -#pragma omp target parallel for if(parallel:cond) firstprivate(fp) reduction(max:rd) linear(lin: step) +#pragma omp target parallel for if(parallel:cond) firstprivate(fp) reduction(max:rd) linear(lin: step) map(map) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TPFS:]]: -// CHECK-SAME: [B1.[[#TPFS+13]]] -// CHECK-NEXT: [[#TPFS+1]]: [B1.[[#TPFS+13]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TPFS+2]]: [B1.[[#TPFS+12]]] -// CHECK-NEXT: [[#TPFS+3]]: [B1.[[#TPFS+12]]] = [B1.[[#TPFS+1]]] +// CHECK-SAME: [B1.[[#TPFS+14]]] +// CHECK-NEXT: [[#TPFS+1]]: [B1.[[#TPFS+14]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TPFS+2]]: [B1.[[#TPFS+13]]] +// CHECK-NEXT: [[#TPFS+3]]: [B1.[[#TPFS+13]]] = [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) @@ -252,29 +254,31 @@ void xxx(int argc) { // CHECK-NEXT: [[#TPFS+9]]: lin // CHECK-NEXT: [[#TPFS+10]]: step // CHECK-NEXT: [[#TPFS+11]]: [B1.[[#TPFS+10]]] (ImplicitCastExpr, LValueToRValue, int) -// CHECK-NEXT: [[#TPFS+12]]: argc -// CHECK-NEXT: [[#TPFS+13]]: x -// CHECK-NEXT: [[#TPFS+14]]: #pragma omp target parallel for simd if(target: cond) firstprivate(fp) reduction(*: rd) linear(lin: step) +// CHECK-NEXT: [[#TPFS+12]]: map +// CHECK-NEXT: [[#TPFS+13]]: argc +// CHECK-NEXT: [[#TPFS+14]]: x +// CHECK-NEXT: [[#TPFS+15]]: #pragma omp target parallel for simd if(target: cond) firstprivate(fp) reduction(*: rd) linear(lin: step) map(tofrom: map) // 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) reduction(*:rd) linear(lin: step) +#pragma omp target parallel for simd if(target:cond) firstprivate(fp) reduction(*:rd) linear(lin: step) map(tofrom:map) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TP:]]: -// 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-SAME: [B1.[[#TP+11]]] +// CHECK-NEXT: [[#TP+1]]: [B1.[[#TP+11]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TP+2]]: [B1.[[#TP+10]]] +// CHECK-NEXT: [[#TP+3]]: [B1.[[#TP+10]]] = [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]]: 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: [[#TP+9]]: map +// CHECK-NEXT: [[#TP+10]]: argc +// CHECK-NEXT: [[#TP+11]]: x +// CHECK-NEXT: [[#TP+12]]: #pragma omp target parallel if(cond) firstprivate(fp) reduction(+: rd) map(to: map) // CHECK-NEXT: [B1.[[#TP+3]]]; -#pragma omp target parallel if(cond) firstprivate(fp) reduction(+:rd) +#pragma omp target parallel if(cond) firstprivate(fp) reduction(+:rd) map(to:map) argc = x; // CHECK-NEXT: [[#TSIMD:]]: // CHECK-SAME: [B1.[[#TSIMD+13]]] @@ -291,10 +295,10 @@ void xxx(int argc) { // CHECK-NEXT: [[#TSIMD+11]]: [B1.[[#TSIMD+10]]] (ImplicitCastExpr, LValueToRValue, int) // CHECK-NEXT: [[#TSIMD+12]]: argc // CHECK-NEXT: [[#TSIMD+13]]: x -// CHECK-NEXT: [[#TSIMD+14]]: #pragma omp target simd if(cond) firstprivate(fp) reduction(+: rd) linear(lin: step) +// CHECK-NEXT: [[#TSIMD+14]]: #pragma omp target simd if(cond) firstprivate(fp) reduction(+: rd) linear(lin: step) map(alloc: map) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TSIMD+3]]]; -#pragma omp target simd if(cond) firstprivate(fp) reduction(+:rd) linear(lin: step) +#pragma omp target simd if(cond) firstprivate(fp) reduction(+:rd) linear(lin: step) map(alloc:map) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TTD:]]: @@ -309,10 +313,10 @@ void xxx(int argc) { // 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: [[#TTD+11]]: #pragma omp target teams distribute if(cond) firstprivate(fp) reduction(+: rd) map(release: map) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TTD+3]]]; -#pragma omp target teams distribute if(cond) firstprivate(fp) reduction(+:rd) +#pragma omp target teams distribute if(cond) firstprivate(fp) reduction(+:rd) map(release:map) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TTDPF:]]: @@ -327,10 +331,10 @@ void xxx(int argc) { // 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: [[#TTDPF+11]]: #pragma omp target teams distribute parallel for if(cond) firstprivate(fp) reduction(+: rd) map(delete: map) // 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) reduction(+:rd) +#pragma omp target teams distribute parallel for if(cond) firstprivate(fp) reduction(+:rd) map(delete:map) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TTDPFS:]]: @@ -345,45 +349,47 @@ void xxx(int argc) { // 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: [[#TTDPFS+11]]: #pragma omp target teams distribute parallel for simd if(parallel: cond) firstprivate(fp) reduction(+: rd) map(from: map) // 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) reduction(+:rd) +#pragma omp target teams distribute parallel for simd if(parallel:cond) firstprivate(fp) reduction(+:rd) map(from:map) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TTDS:]]: -// 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-SAME: [B1.[[#TTDS+11]]] +// CHECK-NEXT: [[#TTDS+1]]: [B1.[[#TTDS+11]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TTDS+2]]: [B1.[[#TTDS+10]]] +// CHECK-NEXT: [[#TTDS+3]]: [B1.[[#TTDS+10]]] = [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]]: 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: [[#TTDS+9]]: map +// CHECK-NEXT: [[#TTDS+10]]: argc +// CHECK-NEXT: [[#TTDS+11]]: x +// CHECK-NEXT: [[#TTDS+12]]: #pragma omp target teams distribute simd if(cond) firstprivate(fp) reduction(+: rd) map(tofrom: map) // CHECK-NEXT: for (int i = 0; i < 10; ++i) // CHECK-NEXT: [B1.[[#TTDS+3]]]; -#pragma omp target teams distribute simd if(cond) firstprivate(fp) reduction(+:rd) +#pragma omp target teams distribute simd if(cond) firstprivate(fp) reduction(+:rd) map(map) for (int i = 0; i < 10; ++i) argc = x; // CHECK-NEXT: [[#TT:]]: -// 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-SAME: [B1.[[#TT+11]]] +// CHECK-NEXT: [[#TT+1]]: [B1.[[#TT+11]]] (ImplicitCastExpr, LValueToRValue, int) +// CHECK-NEXT: [[#TT+2]]: [B1.[[#TT+10]]] +// CHECK-NEXT: [[#TT+3]]: [B1.[[#TT+10]]] = [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]]: 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: [[#TT+9]]: map +// CHECK-NEXT: [[#TT+10]]: argc +// CHECK-NEXT: [[#TT+11]]: x +// CHECK-NEXT: [[#TT+12]]: #pragma omp target teams if(cond) firstprivate(fp) reduction(+: rd) map(tofrom: map) // CHECK-NEXT: [B1.[[#TT+3]]]; -#pragma omp target teams if(cond) firstprivate(fp) reduction(+:rd) +#pragma omp target teams if(cond) firstprivate(fp) reduction(+:rd) map(tofrom:map) argc = x; // CHECK-NEXT: [[#TU:]]: cond // CHECK-NEXT: [[#TU+1]]: [B1.[[#TU]]] (ImplicitCastExpr, LValueToRValue, int) diff --git a/test/OpenMP/target_data_messages.c b/test/OpenMP/target_data_messages.c index 9497ddba02..7dd48f7e50 100644 --- a/test/OpenMP/target_data_messages.c +++ b/test/OpenMP/target_data_messages.c @@ -4,6 +4,13 @@ void foo() { } +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target data map(map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + int main(int argc, char **argv) { int a; #pragma omp target data // expected-error {{expected at least one 'map' or 'use_device_ptr' clause for '#pragma omp target data'}} diff --git a/test/OpenMP/target_enter_data_map_messages.c b/test/OpenMP/target_enter_data_map_messages.c index cd082c63f8..c2701737b7 100644 --- a/test/OpenMP/target_enter_data_map_messages.c +++ b/test/OpenMP/target_enter_data_map_messages.c @@ -4,6 +4,13 @@ // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized // RUN: %clang_cc1 -triple x86_64-apple-macos10.7.0 -verify -fopenmp-simd -ferror-limit 100 -o - -x c++ %s -Wuninitialized +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target enter data map(to: map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + int main(int argc, char **argv) { int r; diff --git a/test/OpenMP/target_map_messages.cpp b/test/OpenMP/target_map_messages.cpp index 15f7b4fe07..56c93915a0 100644 --- a/test/OpenMP/target_map_messages.cpp +++ b/test/OpenMP/target_map_messages.cpp @@ -20,6 +20,14 @@ void foo(int arg) { } #else +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target map(tofrom: map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + + struct SREF { int &a; int b; diff --git a/test/OpenMP/target_parallel_for_map_messages.cpp b/test/OpenMP/target_parallel_for_map_messages.cpp index 0f02350e29..3eba4ba82b 100644 --- a/test/OpenMP/target_parallel_for_map_messages.cpp +++ b/test/OpenMP/target_parallel_for_map_messages.cpp @@ -9,6 +9,13 @@ bool foobool(int argc) { return argc; } +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target parallel for map(tofrom: map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + struct S1; // expected-note 2 {{declared here}} extern S1 a; class S2 { diff --git a/test/OpenMP/target_parallel_for_simd_map_messages.cpp b/test/OpenMP/target_parallel_for_simd_map_messages.cpp index 6f7dc528d8..92dbcf7f6f 100644 --- a/test/OpenMP/target_parallel_for_simd_map_messages.cpp +++ b/test/OpenMP/target_parallel_for_simd_map_messages.cpp @@ -9,6 +9,13 @@ bool foobool(int argc) { return argc; } +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target parallel for simd map(map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + struct S1; // expected-note 2 {{declared here}} extern S1 a; class S2 { diff --git a/test/OpenMP/target_parallel_map_messages.cpp b/test/OpenMP/target_parallel_map_messages.cpp index a7a4e1cd9c..362401e59b 100644 --- a/test/OpenMP/target_parallel_map_messages.cpp +++ b/test/OpenMP/target_parallel_map_messages.cpp @@ -9,6 +9,13 @@ bool foobool(int argc) { return argc; } +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target parallel map(tofrom: map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + struct S1; // expected-note 2 {{declared here}} extern S1 a; class S2 { diff --git a/test/OpenMP/target_simd_map_messages.cpp b/test/OpenMP/target_simd_map_messages.cpp index a93d20eb35..7e85cc094a 100644 --- a/test/OpenMP/target_simd_map_messages.cpp +++ b/test/OpenMP/target_simd_map_messages.cpp @@ -9,6 +9,13 @@ bool foobool(int argc) { return argc; } +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target simd map(to: map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + struct S1; // expected-note 2 {{declared here}} extern S1 a; class S2 { diff --git a/test/OpenMP/target_teams_distribute_map_messages.cpp b/test/OpenMP/target_teams_distribute_map_messages.cpp index f14233f49c..f1ad2ecaa0 100644 --- a/test/OpenMP/target_teams_distribute_map_messages.cpp +++ b/test/OpenMP/target_teams_distribute_map_messages.cpp @@ -9,6 +9,13 @@ bool foobool(int argc) { return argc; } +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target teams distribute map(map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + struct S1; // expected-note 2 {{declared here}} extern S1 a; class S2 { diff --git a/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp index c67b183534..11aaaf2e88 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_map_messages.cpp @@ -9,6 +9,13 @@ bool foobool(int argc) { return argc; } +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target teams distribute parallel for map(tofrom: map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + struct S1; // expected-note 2 {{declared here}} extern S1 a; class S2 { diff --git a/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp b/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp index 908184805a..03d0c237b9 100644 --- a/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp +++ b/test/OpenMP/target_teams_distribute_parallel_for_simd_map_messages.cpp @@ -9,6 +9,13 @@ bool foobool(int argc) { return argc; } +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target teams distribute parallel for simd map(to: map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + struct S1; // expected-note 2 {{declared here}} extern S1 a; class S2 { diff --git a/test/OpenMP/target_teams_distribute_simd_map_messages.cpp b/test/OpenMP/target_teams_distribute_simd_map_messages.cpp index 313bd7400a..ef49201104 100644 --- a/test/OpenMP/target_teams_distribute_simd_map_messages.cpp +++ b/test/OpenMP/target_teams_distribute_simd_map_messages.cpp @@ -9,6 +9,13 @@ bool foobool(int argc) { return argc; } +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target teams distribute simd map(map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + struct S1; // expected-note 2 {{declared here}} extern S1 a; class S2 { diff --git a/test/OpenMP/target_teams_map_messages.cpp b/test/OpenMP/target_teams_map_messages.cpp index b4af6cb4ab..86106b5d00 100644 --- a/test/OpenMP/target_teams_map_messages.cpp +++ b/test/OpenMP/target_teams_map_messages.cpp @@ -21,6 +21,14 @@ void foo(int arg) { {} } #else + +void xxx(int argc) { + int map; // expected-note {{initialize the variable 'map' to silence this warning}} +#pragma omp target teams map(tofrom: map) // expected-warning {{variable 'map' is uninitialized when used here}} + for (int i = 0; i < 10; ++i) + ; +} + template struct SA { static int ss; -- cgit v1.2.1