diff options
author | David Pagan <dave.pagan@amd.com> | 2025-02-05 10:10:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-02-05 10:10:06 -0800 |
commit | 659d1feeaf5ab0a71fd9d89b05f15347a9180547 (patch) | |
tree | b224c590487e79e0100e9f5e5629ac1a7face555 /clang/lib/Sema/SemaOpenMP.cpp | |
parent | 6f750cfb96c74426e002a8353ebd53fdf8a9714a (diff) | |
download | llvm-659d1feeaf5ab0a71fd9d89b05f15347a9180547.zip llvm-659d1feeaf5ab0a71fd9d89b05f15347a9180547.tar.gz llvm-659d1feeaf5ab0a71fd9d89b05f15347a9180547.tar.bz2 |
[clang][OpenMP] OpenMP 6.0 updates to restrictions with order/concurrent (#125621)
From OpenMP 6.0 features list
- OpenMP directives in concurrent loop regions
- atomics constructs on concurrent loop regions
- Lift nesting restriction on concurrent loop
Testing
- Updated test/OpenMP/for_order_messages.cpp
- check-all
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | clang/lib/Sema/SemaOpenMP.cpp | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index ce07b0a..7e36601 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/lib/Sema/SemaOpenMP.cpp @@ -4788,13 +4788,26 @@ static bool checkNestingOfRegions(Sema &SemaRef, const DSAStackTy *Stack, getLeafOrCompositeConstructs(ParentRegion, LeafOrComposite); OpenMPDirectiveKind EnclosingConstruct = ParentLOC.back(); - if (SemaRef.LangOpts.OpenMP >= 51 && Stack->isParentOrderConcurrent() && - CurrentRegion != OMPD_simd && CurrentRegion != OMPD_loop && - CurrentRegion != OMPD_parallel && - !isOpenMPCombinedParallelADirective(CurrentRegion)) { - SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_order) - << getOpenMPDirectiveName(CurrentRegion); - return true; + if (Stack->isParentOrderConcurrent()) { + bool InvalidOrderNesting = false; + if ((SemaRef.LangOpts.OpenMP == 51 || SemaRef.LangOpts.OpenMP == 52) && + CurrentRegion != OMPD_simd && CurrentRegion != OMPD_loop && + CurrentRegion != OMPD_parallel && + !isOpenMPCombinedParallelADirective(CurrentRegion)) { + InvalidOrderNesting = true; + } else if (SemaRef.LangOpts.OpenMP >= 60 && + !isOpenMPOrderConcurrentNestableDirective(CurrentRegion)) { + // OpenMP 6.0 [12.3 order Clause, Restrictions] + // Only regions that correspond to order-concurrent-nestable constructs + // or order-concurrent-nestable routines may be strictly nested regions + // of regions that correspond to constructs on which the order clause is + // specified with concurrent as the ordering argument. + InvalidOrderNesting = true; + } + if (InvalidOrderNesting) { + SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_order) + << getOpenMPDirectiveName(CurrentRegion); + } } if (isOpenMPSimdDirective(ParentRegion) && ((SemaRef.LangOpts.OpenMP <= 45 && CurrentRegion != OMPD_ordered) || @@ -7114,7 +7127,8 @@ ExprResult SemaOpenMP::ActOnOpenMPCall(ExprResult Call, Scope *Scope, if (!CalleeFnDecl) return Call; - if (getLangOpts().OpenMP >= 51 && CalleeFnDecl->getIdentifier() && + if (getLangOpts().OpenMP >= 51 && getLangOpts().OpenMP < 60 && + CalleeFnDecl->getIdentifier() && CalleeFnDecl->getName().starts_with_insensitive("omp_")) { // checking for any calls inside an Order region if (Scope && Scope->isOpenMPOrderClauseScope()) |