summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGStmtOpenMP.cpp
diff options
context:
space:
mode:
authorAlexey Bataev <a.bataev@hotmail.com>2016-05-24 07:40:12 +0000
committerAlexey Bataev <a.bataev@hotmail.com>2016-05-24 07:40:12 +0000
commit9afe57541e4194e947876617ecc993d309214b99 (patch)
tree9d4891ef75f2bc4cee71f5e28a70907d39a7198e /clang/lib/CodeGen/CGStmtOpenMP.cpp
parent6194d9f5d8a295f2e36e9bf9dc135abb1dbfa002 (diff)
downloadbcm5719-llvm-9afe57541e4194e947876617ecc993d309214b99.tar.gz
bcm5719-llvm-9afe57541e4194e947876617ecc993d309214b99.zip
[OPENMP] Fixed codegen for firstprivate vars in standalone worksharing
directives. If firstprivate variable is is captured by value in outlined region and then used as firstprivate variable in inner worksharing directive, the copy for this firstprivate variable was not created. Fixed this bug. llvm-svn: 270536
Diffstat (limited to 'clang/lib/CodeGen/CGStmtOpenMP.cpp')
-rw-r--r--clang/lib/CodeGen/CGStmtOpenMP.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CGStmtOpenMP.cpp b/clang/lib/CodeGen/CGStmtOpenMP.cpp
index d28f2cceb08..cfe4cb714de 100644
--- a/clang/lib/CodeGen/CGStmtOpenMP.cpp
+++ b/clang/lib/CodeGen/CGStmtOpenMP.cpp
@@ -571,6 +571,7 @@ bool CodeGenFunction::EmitOMPFirstprivateClause(const OMPExecutableDirective &D,
cast<VarDecl>(cast<DeclRefExpr>(D)->getDecl())->getCanonicalDecl());
}
llvm::DenseSet<const VarDecl *> EmittedAsFirstprivate;
+ CGCapturedStmtInfo CapturesInfo(cast<CapturedStmt>(*D.getAssociatedStmt()));
for (const auto *C : D.getClausesOfKind<OMPFirstprivateClause>()) {
auto IRef = C->varlist_begin();
auto InitsRef = C->inits().begin();
@@ -578,8 +579,9 @@ bool CodeGenFunction::EmitOMPFirstprivateClause(const OMPExecutableDirective &D,
auto *OrigVD = cast<VarDecl>(cast<DeclRefExpr>(*IRef)->getDecl());
bool ThisFirstprivateIsLastprivate =
Lastprivates.count(OrigVD->getCanonicalDecl()) > 0;
+ auto *CapFD = CapturesInfo.lookup(OrigVD);
auto *FD = CapturedStmtInfo->lookup(OrigVD);
- if (!ThisFirstprivateIsLastprivate && FD &&
+ if (!ThisFirstprivateIsLastprivate && FD && (FD == CapFD) &&
!FD->getType()->isReferenceType()) {
EmittedAsFirstprivate.insert(OrigVD->getCanonicalDecl());
++IRef;
OpenPOWER on IntegriCloud