From: Alexey Bataev Date: Wed, 22 Nov 2017 17:19:31 +0000 (+0000) Subject: [OPENMP] General improvement of code, NFC. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d4fdc25fce366553884883ee57910838b6a11834;p=clang [OPENMP] General improvement of code, NFC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@318849 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Basic/OpenMPKinds.cpp b/lib/Basic/OpenMPKinds.cpp index 6cea8f4597..b318f7e034 100644 --- a/lib/Basic/OpenMPKinds.cpp +++ b/lib/Basic/OpenMPKinds.cpp @@ -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: diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 6c56d0c185..290221a0de 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -6777,13 +6777,24 @@ StmtResult Sema::ActOnOpenMPDistributeParallelForDirective( // 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(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 getOpenMPCaptureRegionForClause( 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: