diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-14 20:44:34 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2019-10-14 20:44:34 +0000 |
commit | 19c95a313cbc80767602410b60d7e7d48ae90d18 (patch) | |
tree | 71b1529474d603ac68c804037eaaccd3017acb52 /lib/Sema/SemaOpenMP.cpp | |
parent | 8d744a73b55b545f704906966e86cb28ede2423c (diff) | |
download | clang-19c95a313cbc80767602410b60d7e7d48ae90d18.tar.gz |
[OPNEMP]Allow num_tasks clause in combined task-based directives.
The expression of the num_tasks clause must be captured in the combined
task-based directives, like 'parallel master taskloop' directive.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@374819 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaOpenMP.cpp')
-rw-r--r-- | lib/Sema/SemaOpenMP.cpp | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 94cd80a4b0..4d6ff009c5 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -4595,12 +4595,16 @@ StmtResult Sema::ActOnOpenMPExecutableDirective( if (isOpenMPParallelDirective(DSAStack->getCurrentDirective())) break; continue; + case OMPC_num_tasks: + // Do not analyze if no parent parallel directive. + if (isOpenMPParallelDirective(DSAStack->getCurrentDirective())) + break; + continue; case OMPC_ordered: case OMPC_device: case OMPC_num_teams: case OMPC_thread_limit: case OMPC_priority: - case OMPC_num_tasks: case OMPC_hint: case OMPC_collapse: case OMPC_safelen: @@ -10778,6 +10782,7 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( } break; case OMPC_grainsize: + case OMPC_num_tasks: switch (DKind) { case OMPD_task: case OMPD_taskloop: @@ -10881,7 +10886,6 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( case OMPC_map: case OMPC_priority: case OMPC_nogroup: - case OMPC_num_tasks: case OMPC_hint: case OMPC_defaultmap: case OMPC_unknown: @@ -15952,15 +15956,20 @@ OMPClause *Sema::ActOnOpenMPNumTasksClause(Expr *NumTasks, SourceLocation LParenLoc, SourceLocation EndLoc) { Expr *ValExpr = NumTasks; + Stmt *HelperValStmt = nullptr; + OpenMPDirectiveKind CaptureRegion = OMPD_unknown; // OpenMP [2.9.2, taskloop Constrcut] // The parameter of the num_tasks clause must be a positive integer // expression. - if (!isNonNegativeIntegerValue(ValExpr, *this, OMPC_num_tasks, - /*StrictlyPositive=*/true)) + if (!isNonNegativeIntegerValue( + ValExpr, *this, OMPC_num_tasks, + /*StrictlyPositive=*/true, /*BuildCapture=*/true, + DSAStack->getCurrentDirective(), &CaptureRegion, &HelperValStmt)) return nullptr; - return new (Context) OMPNumTasksClause(ValExpr, StartLoc, LParenLoc, EndLoc); + return new (Context) OMPNumTasksClause(ValExpr, HelperValStmt, CaptureRegion, + StartLoc, LParenLoc, EndLoc); } OMPClause *Sema::ActOnOpenMPHintClause(Expr *Hint, SourceLocation StartLoc, |