[PATCH] D15258: [PGO] Remove data races on Data->Values field

Betul Buyukkurt via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 17 16:35:44 PST 2015


betulb added inline comments.

================
Comment at: lib/profile/InstrProfilingFile.c:37
@@ +36,3 @@
+      __llvm_profile_gather_value_data(&ValueDataArray);
+  FreeHook = &free;
+  return llvmWriteProfData(fileWriter, File, ValueDataArray, ValueDataSize);
----------------
Is there a purpose for not directly using free, assigning it to a pointer and calling it through the function pointer?

================
Comment at: lib/profile/InstrProfilingValue.c:181
@@ -237,1 +180,3 @@
+
+  return S;
 }
----------------
Is there any need to return S in this implementation? We may also remove the need to pass the ValueDataSize around.

================
Comment at: lib/profile/InstrProfilingWriter.c:68
@@ -63,5 +67,3 @@
     return -1;
-  if (ValueDataBegin) {
-    ProfDataIOVec IOVec2[] = {{ValueDataBegin, sizeof(char), ValueDataSize}};
-    if (Writer(IOVec2, sizeof(IOVec2) / sizeof(*IOVec2), &WriterCtx))
-      return -1;
+  if (ValueDataSize) {
+    ValueProfData **ValueDataArray = ValueDataBegin;
----------------
Instead of ValueDataSize, why not check for if ValueDataBegin is null?


http://reviews.llvm.org/D15258





More information about the llvm-commits mailing list