[PATCH] D18110: [OpenMP] Fix SEMA bug in the capture of global variables in template functions.
Alexey Bataev via cfe-commits
cfe-commits at lists.llvm.org
Tue Mar 29 21:08:33 PDT 2016
ABataev added inline comments.
================
Comment at: lib/Sema/SemaOpenMP.cpp:816-822
@@ -801,6 +815,9 @@
+
+ // A DSA refers to this captured region if the parent contexts match.
+ auto *ParentContext = RSI->TheCapturedDecl->getParent();
for (auto I = Stack.rbegin(), EE = Stack.rend(); I != EE; ++I)
- if (I->CurScope == S)
+ if (I->ParentDeclContext == ParentContext)
return I->Directive;
return OMPD_unknown;
}
----------------
Actually, I think, we need to rework the whole IsOpenMPCapturedByRef() function. I'm not sure that it is even required. It looks like some optimization hack in the frontend. I'm against any not-necessary optimizations in frontend. If scalar value is a firstprivate, it must be handled in codegen, not by handling it by copy.
http://reviews.llvm.org/D18110
More information about the cfe-commits
mailing list