[OPENMP] General improvement of handling of `teams distribute`

directive, NFC.

Some general improvements in support of `teams distribute` directive.

llvm-svn: 319320
This commit is contained in:
Alexey Bataev 2017-11-29 15:14:16 +00:00
parent 02082c39f3
commit 95c6dd49a0
2 changed files with 13 additions and 3 deletions

View File

@ -3893,7 +3893,7 @@ void CodeGenFunction::EmitOMPTeamsDistributeDirective(
CodeGenDistribute); CodeGenDistribute);
CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_teams); CGF.EmitOMPReductionClauseFinal(S, /*ReductionKind=*/OMPD_teams);
}; };
emitCommonOMPTeamsDirective(*this, S, OMPD_teams, CodeGen); emitCommonOMPTeamsDirective(*this, S, OMPD_distribute, CodeGen);
emitPostUpdateForReductionClause(*this, S, emitPostUpdateForReductionClause(*this, S,
[](CodeGenFunction &) { return nullptr; }); [](CodeGenFunction &) { return nullptr; });
} }

View File

@ -7057,14 +7057,24 @@ StmtResult Sema::ActOnOpenMPTeamsDistributeDirective(
// The point of exit cannot be a branch out of the structured block. // The point of exit cannot be a branch out of the structured block.
// longjmp() and throw() must not violate the entry/exit criteria. // longjmp() and throw() must not violate the entry/exit criteria.
CS->getCapturedDecl()->setNothrow(); CS->getCapturedDecl()->setNothrow();
for (int ThisCaptureLevel = getOpenMPCaptureLevels(OMPD_teams_distribute);
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; OMPLoopDirective::HelperExprs B;
// In presence of clause 'collapse' with number of loops, it will // In presence of clause 'collapse' with number of loops, it will
// define the nested loops number. // define the nested loops number.
unsigned NestedLoopCount = unsigned NestedLoopCount =
CheckOpenMPLoop(OMPD_teams_distribute, getCollapseNumberExpr(Clauses), CheckOpenMPLoop(OMPD_teams_distribute, getCollapseNumberExpr(Clauses),
nullptr /*ordered not a clause on distribute*/, AStmt, nullptr /*ordered not a clause on distribute*/, CS, *this,
*this, *DSAStack, VarsWithImplicitDSA, B); *DSAStack, VarsWithImplicitDSA, B);
if (NestedLoopCount == 0) if (NestedLoopCount == 0)
return StmtError(); return StmtError();