Skip to content

Commit 974acd6

Browse files
committed
[OPENMP] Codegen for distribute parallel for simd directive.
Added proper codegen for `distribute parallel for simd` directive. llvm-svn: 319078
1 parent 87ff0a7 commit 974acd6

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

clang/lib/Basic/OpenMPKinds.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -885,6 +885,7 @@ void clang::getOpenMPCaptureRegions(
885885
case OMPD_parallel_for_simd:
886886
case OMPD_parallel_sections:
887887
case OMPD_distribute_parallel_for:
888+
case OMPD_distribute_parallel_for_simd:
888889
CaptureRegions.push_back(OMPD_parallel);
889890
break;
890891
case OMPD_target_teams:
@@ -930,7 +931,6 @@ void clang::getOpenMPCaptureRegions(
930931
case OMPD_task:
931932
case OMPD_taskloop:
932933
case OMPD_taskloop_simd:
933-
case OMPD_distribute_parallel_for_simd:
934934
case OMPD_distribute_simd:
935935
case OMPD_teams_distribute_simd:
936936
case OMPD_teams_distribute_parallel_for_simd:

clang/lib/Sema/SemaOpenMP.cpp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6838,13 +6838,24 @@ StmtResult Sema::ActOnOpenMPDistributeParallelForSimdDirective(
68386838
// The point of exit cannot be a branch out of the structured block.
68396839
// longjmp() and throw() must not violate the entry/exit criteria.
68406840
CS->getCapturedDecl()->setNothrow();
6841+
for (int ThisCaptureLevel =
6842+
getOpenMPCaptureLevels(OMPD_distribute_parallel_for_simd);
6843+
ThisCaptureLevel > 1; --ThisCaptureLevel) {
6844+
CS = cast<CapturedStmt>(CS->getCapturedStmt());
6845+
// 1.2.2 OpenMP Language Terminology
6846+
// Structured block - An executable statement with a single entry at the
6847+
// top and a single exit at the bottom.
6848+
// The point of exit cannot be a branch out of the structured block.
6849+
// longjmp() and throw() must not violate the entry/exit criteria.
6850+
CS->getCapturedDecl()->setNothrow();
6851+
}
68416852

68426853
OMPLoopDirective::HelperExprs B;
68436854
// In presence of clause 'collapse' with number of loops, it will
68446855
// define the nested loops number.
68456856
unsigned NestedLoopCount = CheckOpenMPLoop(
68466857
OMPD_distribute_parallel_for_simd, getCollapseNumberExpr(Clauses),
6847-
nullptr /*ordered not a clause on distribute*/, AStmt, *this, *DSAStack,
6858+
nullptr /*ordered not a clause on distribute*/, CS, *this, *DSAStack,
68486859
VarsWithImplicitDSA, B);
68496860
if (NestedLoopCount == 0)
68506861
return StmtError();
@@ -7793,14 +7804,14 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
77937804
CaptureRegion = OMPD_teams;
77947805
break;
77957806
case OMPD_distribute_parallel_for:
7807+
case OMPD_distribute_parallel_for_simd:
77967808
CaptureRegion = OMPD_parallel;
77977809
break;
77987810
case OMPD_parallel_for:
77997811
case OMPD_parallel_for_simd:
78007812
case OMPD_target_teams_distribute_parallel_for:
78017813
case OMPD_target_teams_distribute_parallel_for_simd:
78027814
case OMPD_teams_distribute_parallel_for_simd:
7803-
case OMPD_distribute_parallel_for_simd:
78047815
// Do not capture schedule clause expressions.
78057816
break;
78067817
case OMPD_task:

0 commit comments

Comments
 (0)