r318849 - [OPENMP] General improvement of code, NFC.

Alexey Bataev via cfe-commits cfe-commits at lists.llvm.org
Wed Nov 22 09:19:31 PST 2017


Author: abataev
Date: Wed Nov 22 09:19:31 2017
New Revision: 318849

URL: http://llvm.org/viewvc/llvm-project?rev=318849&view=rev
Log:
[OPENMP] General improvement of code, NFC.

Modified:
    cfe/trunk/lib/Basic/OpenMPKinds.cpp
    cfe/trunk/lib/Sema/SemaOpenMP.cpp

Modified: cfe/trunk/lib/Basic/OpenMPKinds.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/OpenMPKinds.cpp?rev=318849&r1=318848&r2=318849&view=diff
==============================================================================
--- cfe/trunk/lib/Basic/OpenMPKinds.cpp (original)
+++ cfe/trunk/lib/Basic/OpenMPKinds.cpp Wed Nov 22 09:19:31 2017
@@ -901,6 +901,17 @@ void clang::getOpenMPCaptureRegions(
     CaptureRegions.push_back(OMPD_teams);
     CaptureRegions.push_back(OMPD_parallel);
     break;
+  case OMPD_target_parallel:
+  case OMPD_target_parallel_for:
+  case OMPD_target_parallel_for_simd:
+    CaptureRegions.push_back(OMPD_target);
+    CaptureRegions.push_back(OMPD_parallel);
+    break;
+  case OMPD_target_enter_data:
+  case OMPD_target_exit_data:
+  case OMPD_target_update:
+    CaptureRegions.push_back(OMPD_task);
+    break;
   case OMPD_teams:
   case OMPD_simd:
   case OMPD_for:
@@ -929,17 +940,6 @@ void clang::getOpenMPCaptureRegions(
   case OMPD_target_teams_distribute_simd:
     CaptureRegions.push_back(DKind);
     break;
-  case OMPD_target_parallel:
-  case OMPD_target_parallel_for:
-  case OMPD_target_parallel_for_simd:
-    CaptureRegions.push_back(OMPD_target);
-    CaptureRegions.push_back(OMPD_parallel);
-    break;
-  case OMPD_target_enter_data:
-  case OMPD_target_exit_data:
-  case OMPD_target_update:
-    CaptureRegions.push_back(OMPD_task);
-    break;
   case OMPD_threadprivate:
   case OMPD_taskyield:
   case OMPD_barrier:

Modified: cfe/trunk/lib/Sema/SemaOpenMP.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaOpenMP.cpp?rev=318849&r1=318848&r2=318849&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaOpenMP.cpp (original)
+++ cfe/trunk/lib/Sema/SemaOpenMP.cpp Wed Nov 22 09:19:31 2017
@@ -6777,13 +6777,24 @@ StmtResult Sema::ActOnOpenMPDistributePa
   // The point of exit cannot be a branch out of the structured block.
   // longjmp() and throw() must not violate the entry/exit criteria.
   CS->getCapturedDecl()->setNothrow();
+  for (int ThisCaptureLevel =
+           getOpenMPCaptureLevels(OMPD_distribute_parallel_for);
+       ThisCaptureLevel > 1; --ThisCaptureLevel) {
+    CS = cast<CapturedStmt>(CS->getCapturedStmt());
+    // 1.2.2 OpenMP Language Terminology
+    // Structured block - An executable statement with a single entry at the
+    // top and a single exit at the bottom.
+    // The point of exit cannot be a branch out of the structured block.
+    // longjmp() and throw() must not violate the entry/exit criteria.
+    CS->getCapturedDecl()->setNothrow();
+  }
 
   OMPLoopDirective::HelperExprs B;
   // In presence of clause 'collapse' with number of loops, it will
   // define the nested loops number.
   unsigned NestedLoopCount = CheckOpenMPLoop(
       OMPD_distribute_parallel_for, getCollapseNumberExpr(Clauses),
-      nullptr /*ordered not a clause on distribute*/, AStmt, *this, *DSAStack,
+      nullptr /*ordered not a clause on distribute*/, CS, *this, *DSAStack,
       VarsWithImplicitDSA, B);
   if (NestedLoopCount == 0)
     return StmtError();
@@ -7723,14 +7734,16 @@ static OpenMPDirectiveKind getOpenMPCapt
     case OMPD_teams_distribute_parallel_for:
       CaptureRegion = OMPD_teams;
       break;
+    case OMPD_distribute_parallel_for:
+      CaptureRegion = OMPD_parallel;
+      break;
     case OMPD_parallel_for:
     case OMPD_parallel_for_simd:
     case OMPD_target_teams_distribute_parallel_for:
     case OMPD_target_teams_distribute_parallel_for_simd:
     case OMPD_teams_distribute_parallel_for_simd:
-    case OMPD_distribute_parallel_for:
     case OMPD_distribute_parallel_for_simd:
-      // Do not capture thread_limit-clause expressions.
+      // Do not capture schedule clause expressions.
       break;
     case OMPD_task:
     case OMPD_taskloop:




More information about the cfe-commits mailing list