summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-11-11 13:44:42 -0500
committerAlexey Bataev <a.bataev@hotmail.com>2019-11-11 14:28:28 -0500
commitf8c12edd1a5200abbbb2c8da754d6a3bfa7545a0 (patch)
tree66ad67c27792c3821edc17e0a8affb5c90b482d7 /clang/lib/Sema/SemaOpenMP.cpp
parent0e0dea82681a86a09ceed0afd321367a35bfa051 (diff)
downloadbcm5719-llvm-f8c12edd1a5200abbbb2c8da754d6a3bfa7545a0.tar.gz
bcm5719-llvm-f8c12edd1a5200abbbb2c8da754d6a3bfa7545a0.zip
[OPENMP50]Add support for nested atomic and simd constructs in
simd-based directives. According to OpenMP 5.0 standard, ordered simd, atomic and simd directives are allowed as nested directives in the simd-based directives.
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 7ed582f8446..5c1b39e0b39 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -3799,7 +3799,10 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack,
ShouldBeInTargetRegion,
ShouldBeInTeamsRegion
} Recommend = NoRecommend;
- if (isOpenMPSimdDirective(ParentRegion) && CurrentRegion != OMPD_ordered) {
+ if (isOpenMPSimdDirective(ParentRegion) &&
+ ((SemaRef.LangOpts.OpenMP <= 45 && CurrentRegion != OMPD_ordered) ||
+ (SemaRef.LangOpts.OpenMP >= 50 && CurrentRegion != OMPD_ordered &&
+ CurrentRegion != OMPD_simd && CurrentRegion != OMPD_atomic))) {
// OpenMP [2.16, Nesting of Regions]
// OpenMP constructs may not be nested inside a simd region.
// OpenMP [2.8.1,simd Construct, Restrictions]
@@ -3808,9 +3811,14 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack,
// Allowing a SIMD construct nested in another SIMD construct is an
// extension. The OpenMP 4.5 spec does not allow it. Issue a warning
// message.
+ // OpenMP 5.0 [2.9.3.1, simd Construct, Restrictions]
+ // The only OpenMP constructs that can be encountered during execution of
+ // a simd region are the atomic construct, the loop construct, the simd
+ // construct and the ordered construct with the simd clause.
SemaRef.Diag(StartLoc, (CurrentRegion != OMPD_simd)
? diag::err_omp_prohibited_region_simd
- : diag::warn_omp_nesting_simd);
+ : diag::warn_omp_nesting_simd)
+ << (SemaRef.LangOpts.OpenMP >= 50 ? 1 : 0);
return CurrentRegion != OMPD_simd;
}
if (ParentRegion == OMPD_atomic) {
@@ -8165,7 +8173,8 @@ StmtResult Sema::ActOnOpenMPOrderedDirective(ArrayRef<OMPClause *> Clauses,
// OpenMP [2.8.1,simd Construct, Restrictions]
// An ordered construct with the simd clause is the only OpenMP construct
// that can appear in the simd region.
- Diag(StartLoc, diag::err_omp_prohibited_region_simd);
+ Diag(StartLoc, diag::err_omp_prohibited_region_simd)
+ << (LangOpts.OpenMP >= 50 ? 1 : 0);
ErrorFound = true;
} else if (DependFound && (TC || SC)) {
Diag(DependFound->getBeginLoc(), diag::err_omp_depend_clause_thread_simd)
OpenPOWER on IntegriCloud