ABataev added inline comments.

================
Comment at: lib/Sema/SemaOpenMP.cpp:160-667
@@ -159,4 +159,8 @@
 
+  /// \brief Check if the specified variable is a 'copyin' variable for current
+  /// region.
+  bool isCopyinVariable(VarDecl *D);
+
   /// \brief Adds explicit data sharing attribute to the specified declaration.
   void addDSA(VarDecl *D, DeclRefExpr *E, OpenMPClauseKind A);
 

@@ -412,6 +416,12 @@
   return Stack.back().LCVSet.count(D) > 0;
 }
 
+bool DSAStackTy::isCopyinVariable(VarDecl *D){
+  assert(Stack.size() > 1 && "Data-sharing attributes stack is empty");
+  D = D->getCanonicalDecl();
+  DSAInfo I = Stack.back().SharingMap.lookup(D);
+  return I.Attributes == OMPC_copyin;
+}
 void DSAStackTy::addDSA(VarDecl *D, DeclRefExpr *E, OpenMPClauseKind A) {
   D = D->getCanonicalDecl();
   if (A == OMPC_threadprivate) {

@@ -653,4 +663,6 @@
   assert(LangOpts.OpenMP && "OpenMP is not allowed");
   VD = VD->getCanonicalDecl();
   if (DSAStack->getCurrentDirective() != OMPD_unknown) {
+    if (DSAStack->isCopyinVariable(VD) && !DSAStack->isClauseParsingMode())
+      return true;
     if (DSAStack->isLoopControlVariable(VD) ||
----------------
ABataev wrote:
> I'd better write a new function isOpenMPPrivateOrCopyin() function and used 
> it instead of isOpenMPPrivate() in Sema::IsOpenMPCapturedVar(). Besides, 
> note, that copyin variables must be captured only if TLS mode is on, if we're 
> using runtime calls we don't need to capture threadprivates.
If you want to capture copyin variable only in closely nested OpenMP region, it 
is enough just to make next changes in Sema::IsOpenMPCapturedVar():
...
auto DVarPrivate = DSAStack->getTopDSA(VD, DSAStack->isClauseParsingMode());
if (DVarPrivate.CKind != OMPC_unknown && (isOpenMPPrivate(DVarPrivate.CKind) || 
(getLangOpts().OpenMPTLS && DVarPrivate.CKind == OMPC_copyin))
...


http://reviews.llvm.org/D11395




_______________________________________________
cfe-commits mailing list
cfe-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to