================
@@ -5386,18 +5406,23 @@ static bool checkNestingOfRegions(Sema &SemaRef, const 
DSAStackTy *Stack,
   OpenMPDirectiveKind EnclosingConstruct = ParentLOC.back();
   llvm::omp::Version OMPVersion = SemaRef.getLangOpts().getOpenMPVersion();
 
-  if (OMPVersion >= 50 && Stack->isParentOrderConcurrent() &&
+  if (OMPVersion >= 50 && Stack->isEnclosingOrderConcurrent() &&
       !isOpenMPOrderConcurrentNestableDirective(CurrentRegion,
                                                 SemaRef.LangOpts)) {
     SemaRef.Diag(StartLoc, diag::err_omp_prohibited_region_order)
         << getOpenMPDirectiveName(CurrentRegion, OMPVersion);
     return true;
   }
-  if (isOpenMPSimdDirective(ParentRegion) &&
+  // A construct nested in a loop-transforming or ordered construct is still
+  // encountered during execution of an enclosing simd region.
+  if (Stack->isInSimdRegion() &&
       ((OMPVersion <= 45 && CurrentRegion != OMPD_ordered_blockassoc) ||
-       (OMPVersion >= 50 && CurrentRegion != OMPD_ordered_blockassoc &&
-        CurrentRegion != OMPD_simd && CurrentRegion != OMPD_atomic &&
-        CurrentRegion != OMPD_scan))) {
+       (OMPVersion >= 50 &&
+        !isOpenMPSimdizableDirective(CurrentRegion, SemaRef.LangOpts) &&
+        // The loop construct is simdizable if and only if its binding region
+        // is not defined: no bind clause, or bind(thread).
+        !(CurrentRegion == OMPD_loop &&
+          (BindKind == OMPC_BIND_unknown || BindKind == OMPC_BIND_thread))))) {
----------------
alexey-bataev wrote:

```suggestion
        !isOpenMPSimdizableDirective(CurrentRegion, SemaRef.LangOpts)))) {
```

https://github.com/llvm/llvm-project/pull/231852
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to