summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2019-10-15 19:37:05 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2019-10-15 19:37:05 +0000
commit3a842ec3ca4dffc1f8da88121c239b6dbb2209f0 (patch)
treeff343720bba46bfe2bd431bbc51eaf32b2f5601f /clang/lib/Sema/SemaOpenMP.cpp
parent1875dcc47887b2ba582e26b7014ba1eaa82ea1de (diff)
downloadbcm5719-llvm-3a842ec3ca4dffc1f8da88121c239b6dbb2209f0.tar.gz
bcm5719-llvm-3a842ec3ca4dffc1f8da88121c239b6dbb2209f0.zip
[OPENMP]Allow final clause in combined task-based directives.
The condition of the final clause must be captured in the combined task-based directives, like 'parallel master taskloop' directive. llvm-svn: 374942
Diffstat (limited to 'clang/lib/Sema/SemaOpenMP.cpp')
-rw-r--r--clang/lib/Sema/SemaOpenMP.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 4d6ff009c56..b3f711bc7fa 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -4600,6 +4600,11 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
if (isOpenMPParallelDirective(DSAStack->getCurrentDirective()))
break;
continue;
+ case OMPC_final:
+ // Do not analyze if no parent parallel directive.
+ if (isOpenMPParallelDirective(DSAStack->getCurrentDirective()))
+ break;
+ continue;
case OMPC_ordered:
case OMPC_device:
case OMPC_num_teams:
@@ -4609,7 +4614,6 @@ StmtResult Sema::ActOnOpenMPExecutableDirective(
case OMPC_collapse:
case OMPC_safelen:
case OMPC_simdlen:
- case OMPC_final:
case OMPC_default:
case OMPC_proc_bind:
case OMPC_private:
@@ -10783,6 +10787,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
break;
case OMPC_grainsize:
case OMPC_num_tasks:
+ case OMPC_final:
switch (DKind) {
case OMPD_task:
case OMPD_taskloop:
@@ -10858,7 +10863,6 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause(
case OMPC_linear:
case OMPC_default:
case OMPC_proc_bind:
- case OMPC_final:
case OMPC_safelen:
case OMPC_simdlen:
case OMPC_allocator:
@@ -10945,6 +10949,8 @@ OMPClause *Sema::ActOnOpenMPFinalClause(Expr *Condition,
SourceLocation LParenLoc,
SourceLocation EndLoc) {
Expr *ValExpr = Condition;
+ Stmt *HelperValStmt = nullptr;
+ OpenMPDirectiveKind CaptureRegion = OMPD_unknown;
if (!Condition->isValueDependent() && !Condition->isTypeDependent() &&
!Condition->isInstantiationDependent() &&
!Condition->containsUnexpandedParameterPack()) {
@@ -10953,10 +10959,21 @@ OMPClause *Sema::ActOnOpenMPFinalClause(Expr *Condition,
return nullptr;
ValExpr = MakeFullExpr(Val.get()).get();
+
+ OpenMPDirectiveKind DKind = DSAStack->getCurrentDirective();
+ CaptureRegion = getOpenMPCaptureRegionForClause(DKind, OMPC_final);
+ if (CaptureRegion != OMPD_unknown && !CurContext->isDependentContext()) {
+ ValExpr = MakeFullExpr(ValExpr).get();
+ llvm::MapVector<const Expr *, DeclRefExpr *> Captures;
+ ValExpr = tryBuildCapture(*this, ValExpr, Captures).get();
+ HelperValStmt = buildPreInits(Context, Captures);
+ }
}
- return new (Context) OMPFinalClause(ValExpr, StartLoc, LParenLoc, EndLoc);
+ return new (Context) OMPFinalClause(ValExpr, HelperValStmt, CaptureRegion,
+ StartLoc, LParenLoc, EndLoc);
}
+
ExprResult Sema::PerformOpenMPImplicitIntegerConversion(SourceLocation Loc,
Expr *Op) {
if (!Op)
OpenPOWER on IntegriCloud