From 7f96c375acaab34d2b314840431b07f13e3b68d0 Mon Sep 17 00:00:00 2001 From: Alexey Bataev Date: Wed, 22 Nov 2017 17:19:31 +0000 Subject: [PATCH] [OPENMP] General improvement of code, NFC. llvm-svn: 318849 --- clang/lib/Basic/OpenMPKinds.cpp | 22 +++++++++++----------- clang/lib/Sema/SemaOpenMP.cpp | 19 ++++++++++++++++--- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/clang/lib/Basic/OpenMPKinds.cpp b/clang/lib/Basic/OpenMPKinds.cpp index 6cea8f4..b318f7e 100644 --- a/clang/lib/Basic/OpenMPKinds.cpp +++ b/clang/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/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp index 6c56d0c..290221a 100644 --- a/clang/lib/Sema/SemaOpenMP.cpp +++ b/clang/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: -- 2.7.4