[PATCH] D37822: [OpenCL] Clean up and add missing fields for block struct

Anastasia Stulova via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Sep 25 09:28:34 PDT 2017


Anastasia added inline comments.


================
Comment at: lib/CodeGen/CGBlocks.cpp:311
+    // The header is basically 'struct { int; int; generic void *;
+    // custom_fields; }'. Assert that that struct is packed.
+    auto GenPtrAlign = CharUnits::fromQuantity(
----------------
remove one "that".


================
Comment at: lib/CodeGen/CGBlocks.cpp:312
+    // custom_fields; }'. Assert that that struct is packed.
+    auto GenPtrAlign = CharUnits::fromQuantity(
+        CGM.getTarget().getPointerAlign(LangAS::opencl_generic) / 8);
----------------
I think the alignment might not be computed correctly now if there will be custom fields that might have a bigger size than a pointer? Also what happens if we have captures as well?


================
Comment at: lib/CodeGen/CGBlocks.cpp:850
+                           CGM.getDataLayout().getTypeAllocSize(I->getType())),
+                       "block.custom");
+      }
----------------
do we need to add numeration to each item name?


================
Comment at: lib/CodeGen/CGBlocks.cpp:1250
   // Function
   fields.add(blockFn);
 
----------------
If we reorder fields and put this on top we can merge the if statements above and below this point.


https://reviews.llvm.org/D37822





More information about the cfe-commits mailing list