Mostly seems fine, but using a global variable is problematic.

================
Comment at: lib/CodeGen/CGStmtOpenMP.cpp:980
@@ +979,3 @@
+    CGF.Builder.CreateAlignedStore(Chunk, LoopChunk, Alignment);
+    return LoopChunk;
+  }
----------------
Using a global variable here makes this non-reentrant.  Unless there's some 
weird restriction on where this clause can appear, that's not okay.

You might have to capture this value in the CapturedStmt.  That should just be 
a matter of making an artificial VarDecl, initializing it to the captured 
value, and capturing it.  If you can capture it by value instead of by 
reference, that would be slightly preferable.

================
Comment at: lib/CodeGen/CGStmtOpenMP.cpp:1052
@@ -1020,5 +1051,3 @@
         ScheduleKind = C->getScheduleKind();
-        if (auto Ch = C->getChunkSize()) {
-          Chunk = EmitScalarExpr(Ch);
-          Chunk = EmitScalarConversion(Chunk, Ch->getType(),
-                                       S.getIterationVariable()->getType());
+        if (Chunk && Chunk->getType()->isPointerTy()) {
+          Chunk = Builder.CreateAlignedLoad(
----------------
Please test for a global value instead of checking the type.

http://reviews.llvm.org/D9606

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/



_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to