[PATCH] D57690: [OPENMP] issue error messages for multiple teams contructs in a target constructs
kkwli0 closed this revision. kkwli0 added a comment. Committed: r353186 CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57690/new/ https://reviews.llvm.org/D57690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57690: [OPENMP] issue error messages for multiple teams contructs in a target constructs
ABataev accepted this revision. ABataev added a comment. This revision is now accepted and ready to land. LG CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57690/new/ https://reviews.llvm.org/D57690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57690: [OPENMP] issue error messages for multiple teams contructs in a target constructs
kkwli0 updated this revision to Diff 185125. kkwli0 marked an inline comment as done. kkwli0 added a comment. Update based on review comment. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57690/new/ https://reviews.llvm.org/D57690 Files: clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/nesting_of_regions.cpp Index: clang/test/OpenMP/nesting_of_regions.cpp === --- clang/test/OpenMP/nesting_of_regions.cpp +++ clang/test/OpenMP/nesting_of_regions.cpp @@ -4080,6 +4080,13 @@ } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; @@ -12693,6 +12700,13 @@ } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; Index: clang/lib/Sema/SemaOpenMP.cpp === --- clang/lib/Sema/SemaOpenMP.cpp +++ clang/lib/Sema/SemaOpenMP.cpp @@ -7067,7 +7067,9 @@ auto I = CS->body_begin(); while (I != CS->body_end()) { const auto *OED = dyn_cast(*I); -if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) { +if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()) || +OMPTeamsFound) { + OMPTeamsFound = false; break; } Index: clang/test/OpenMP/nesting_of_regions.cpp === --- clang/test/OpenMP/nesting_of_regions.cpp +++ clang/test/OpenMP/nesting_of_regions.cpp @@ -4080,6 +4080,13 @@ } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; @@ -12693,6 +12700,13 @@ } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; Index: clang/lib/Sema/SemaOpenMP.cpp === --- clang/lib/Sema/SemaOpenMP.cpp +++ clang/lib/Sema/SemaOpenMP.cpp @@ -7067,7 +7067,9 @@ auto I = CS->body_begin(); while (I != CS->body_end()) { const auto *OED = dyn_cast(*I); -if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) { +if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()) || +OMPTeamsFound) { + OMPTeamsFound = false; break; } ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57690: [OPENMP] issue error messages for multiple teams contructs in a target constructs
kkwli0 marked 2 inline comments as done. kkwli0 added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:7070 const auto *OED = dyn_cast(*I); -if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) { +if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()) || +(isOpenMPTeamsDirective(OED->getDirectiveKind()) && ABataev wrote: > just `if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind() || > OMPTeamsFound)` Yep, it simplifies the logic. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57690/new/ https://reviews.llvm.org/D57690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57690: [OPENMP] issue error messages for multiple teams contructs in a target constructs
ABataev added inline comments. Comment at: clang/lib/Sema/SemaOpenMP.cpp:7070 const auto *OED = dyn_cast(*I); -if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) { +if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()) || +(isOpenMPTeamsDirective(OED->getDirectiveKind()) && just `if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind() || OMPTeamsFound)` CHANGES SINCE LAST ACTION https://reviews.llvm.org/D57690/new/ https://reviews.llvm.org/D57690 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
[PATCH] D57690: [OPENMP] issue error messages for multiple teams contructs in a target constructs
kkwli0 created this revision. kkwli0 added a reviewer: ABataev. Herald added a subscriber: guansong. The compiler does not generate any error messages if there are more than one teams construct inside a target constructs. #pragma omp target { #pragma omp teams { ... } #pragma omp teams { ... } } After the fix, the error messages are issued. teams.c:4:9: error: target construct with nested teams region contains statements outside of the teams construct #pragma omp target ^ teams.c:14:11: note: nested teams construct here #pragma omp teams ^ teams.c:9:11: note: directive outside teams construct here #pragma omp teams ^ 1 error generated. https://reviews.llvm.org/D57690 Files: clang/lib/Sema/SemaOpenMP.cpp clang/test/OpenMP/nesting_of_regions.cpp Index: clang/test/OpenMP/nesting_of_regions.cpp === --- clang/test/OpenMP/nesting_of_regions.cpp +++ clang/test/OpenMP/nesting_of_regions.cpp @@ -4080,6 +4080,13 @@ } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; @@ -12693,6 +12700,13 @@ } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; Index: clang/lib/Sema/SemaOpenMP.cpp === --- clang/lib/Sema/SemaOpenMP.cpp +++ clang/lib/Sema/SemaOpenMP.cpp @@ -7067,7 +7067,10 @@ auto I = CS->body_begin(); while (I != CS->body_end()) { const auto *OED = dyn_cast(*I); -if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) { +if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()) || +(isOpenMPTeamsDirective(OED->getDirectiveKind()) && + OMPTeamsFound)) { + OMPTeamsFound = false; break; } Index: clang/test/OpenMP/nesting_of_regions.cpp === --- clang/test/OpenMP/nesting_of_regions.cpp +++ clang/test/OpenMP/nesting_of_regions.cpp @@ -4080,6 +4080,13 @@ } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; @@ -12693,6 +12700,13 @@ } #pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} { +#pragma omp teams // expected-note {{directive outside teams construct here}} +++a; +#pragma omp teams // expected-note {{nested teams construct here}} +++a; + } +#pragma omp target // expected-error {{target construct with nested teams region contains statements outside of the teams construct}} + { ++a; // expected-note {{statement outside teams construct here}} #pragma omp teams // expected-note {{nested teams construct here}} ++a; Index: clang/lib/Sema/SemaOpenMP.cpp === --- clang/lib/Sema/SemaOpenMP.cpp +++ clang/lib/Sema/SemaOpenMP.cpp @@ -7067,7 +7067,10 @@ auto I = CS->body_begin(); while (I != CS->body_end()) { const auto *OED = dyn_cast(*I); -if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind())) { +if (!OED || !isOpenMPTeamsDirective(OED->getDirectiveKind()) || +(isOpenMPTeamsDirective(OED->getDirectiveKind()) && + OMPTeamsFound)) { +