diff options
author | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-27 17:58:32 +0000 |
---|---|---|
committer | Alexey Bataev <a.bataev@hotmail.com> | 2017-12-27 17:58:32 +0000 |
commit | a847afa6b944e231900d65a96e61f4a93f73c42f (patch) | |
tree | 0dc2dd8e8b95d81d80128de63098bcc9cfbb0dc0 /lib/Sema | |
parent | 77557aecc90a723055af7ba5dfddd730c5d5e29a (diff) |
[OPENMP] Support for `depend` clauses on `target data update`.
Added codegen for `depend` clauses on `target data update` directives.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@321493 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema')
-rw-r--r-- | lib/Sema/SemaOpenMP.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Sema/SemaOpenMP.cpp b/lib/Sema/SemaOpenMP.cpp index 0880b2d790..9424220577 100644 --- a/lib/Sema/SemaOpenMP.cpp +++ b/lib/Sema/SemaOpenMP.cpp @@ -1297,7 +1297,8 @@ bool Sema::IsOpenMPCapturedByRef(ValueDecl *D, unsigned Level) { Level, /*NotLastprivate=*/true) && // If the variable is artificial and must be captured by value - try to // capture by value. - !(isa<OMPCapturedExprDecl>(D) && D->hasAttr<OMPCaptureKindAttr>()); + !(isa<OMPCapturedExprDecl>(D) && !D->hasAttr<OMPCaptureNoInitAttr>() && + !cast<OMPCapturedExprDecl>(D)->getInit()->isGLValue()); } // When passing data by copy, we need to make sure it fits the uintptr size @@ -2326,7 +2327,6 @@ static OMPCapturedExprDecl *buildCaptureDecl(Sema &S, IdentifierInfo *Id, ASTContext &C = S.getASTContext(); Expr *Init = AsExpression ? CaptureExpr : CaptureExpr->IgnoreImpCasts(); QualType Ty = Init->getType(); - Attr *OMPCaptureKind = nullptr; if (CaptureExpr->getObjectKind() == OK_Ordinary && CaptureExpr->isGLValue()) { if (S.getLangOpts().CPlusPlus) { Ty = C.getLValueReferenceType(Ty); @@ -2339,16 +2339,11 @@ static OMPCapturedExprDecl *buildCaptureDecl(Sema &S, IdentifierInfo *Id, Init = Res.get(); } WithInit = true; - } else if (AsExpression) { - // This variable must be captured by value. - OMPCaptureKind = OMPCaptureKindAttr::CreateImplicit(C, OMPC_unknown); } auto *CED = OMPCapturedExprDecl::Create(C, S.CurContext, Id, Ty, CaptureExpr->getLocStart()); if (!WithInit) CED->addAttr(OMPCaptureNoInitAttr::CreateImplicit(C, SourceRange())); - if (OMPCaptureKind) - CED->addAttr(OMPCaptureKind); S.CurContext->addHiddenDecl(CED); S.AddInitializerToDecl(CED, Init, /*DirectInit=*/false); return CED; @@ -7628,6 +7623,9 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( case OMPD_teams_distribute_parallel_for_simd: CaptureRegion = OMPD_teams; break; + case OMPD_target_update: + CaptureRegion = OMPD_task; + break; case OMPD_cancel: case OMPD_parallel: case OMPD_parallel_sections: @@ -7646,7 +7644,6 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( case OMPD_target_data: case OMPD_target_enter_data: case OMPD_target_exit_data: - case OMPD_target_update: // Do not capture if-clause expressions. break; case OMPD_threadprivate: @@ -8007,6 +8004,9 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( break; case OMPC_device: switch (DKind) { + case OMPD_target_update: + CaptureRegion = OMPD_task; + break; case OMPD_target_teams: case OMPD_target_teams_distribute: case OMPD_target_teams_distribute_simd: @@ -8015,7 +8015,6 @@ static OpenMPDirectiveKind getOpenMPCaptureRegionForClause( case OMPD_target_data: case OMPD_target_enter_data: case OMPD_target_exit_data: - case OMPD_target_update: case OMPD_target: case OMPD_target_simd: case OMPD_target_parallel: |