[PATCH] [OPENMP] Codegen for 'private' clause in 'parallel' directive

Alexey Bataev a.bataev at hotmail.com
Wed Sep 24 21:03:10 PDT 2014


================
Comment at: lib/CodeGen/CGStmtOpenMP.cpp:52
@@ +51,3 @@
+  if (!OuterDeclMap.empty()) {
+    // Emit implicit barrier to synchronize threads and avoid data races.
+    // Build call __kmpc_barrier(loc, gtid)
----------------
hfinkel wrote:
> The note in the patch summary, that this is to ensure all threads initialize using the original values of the variables, is more informative than this comment.
Ok, I'll add another comment.

================
Comment at: lib/Serialization/ASTWriterStmt.cpp:1755
@@ -1754,2 +1754,3 @@
   Writer->Writer.AddSourceLocation(C->getLParenLoc(), Record);
-  for (auto *VE : C->varlists())
+  for (auto *VE : C->varlists()) {
+    Writer->Writer.AddStmt(VE);
----------------
hfinkel wrote:
> Don't need {}
Required for compatibility with MSVC.

================
Comment at: lib/Serialization/ASTWriterStmt.cpp:1758
@@ -1756,1 +1757,3 @@
+  }
+  for (auto *VE : C->private_copies()) {
     Writer->Writer.AddStmt(VE);
----------------
hfinkel wrote:
> Don't need {}
The same.

http://reviews.llvm.org/D4752






More information about the cfe-commits mailing list