[OPENMP] DSA fix

llvm-svn: 204143
This commit is contained in:
Alexey Bataev 2014-03-18 12:19:12 +00:00
parent 213bb00245
commit 750a58bcd9
1 changed files with 16 additions and 1 deletions

View File

@ -134,7 +134,22 @@ DSAStackTy::DSAVarData DSAStackTy::getDSA(StackTy::reverse_iterator Iter,
VarDecl *D) {
DSAVarData DVar;
if (Iter == Stack.rend() - 1) {
DVar.CKind = OMPC_shared;
// OpenMP [2.9.1.1, Data-sharing Attribute Rules for Variables Referenced
// in a region but not in construct]
// File-scope or namespace-scope variables referenced in called routines
// in the region are shared unless they appear in a threadprivate
// directive.
// TODO
if (!D->isFunctionOrMethodVarDecl())
DVar.CKind = OMPC_shared;
// OpenMP [2.9.1.2, Data-sharing Attribute Rules for Variables Referenced
// in a region but not in construct]
// Variables with static storage duration that are declared in called
// routines in the region are shared.
if (D->hasGlobalStorage())
DVar.CKind = OMPC_shared;
return DVar;
}