[compiler-rt] Fixed __llvm_profile_write_buffer in presence of ValueProfileData. (PR #97350)

Mingming Liu via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 2 17:24:32 PDT 2024


================
@@ -214,6 +221,37 @@ static int writeOneValueProfData(ProfBufferIO *BufferIO,
   return 0;
 }
 
+/* Compute size of VPData, without actually writing it. This function follows
+ * the logic of writeValueProfData below it. It is used for predicting how big
+ * a buffer is needed to store the ValueProfileData.
+ * Note that this function returns -1 as an error indicator and 0 is
+ * a potentially valid value.
+ */
+int64_t
+__llvm_profile_getSizeOfValueProfData(VPDataReaderType *VPDataReader,
----------------
minglotus-6 wrote:

nit: use camelCase for consistency with the rest of the function in InstrProfilingWriter.c

`getValueProfSize` sounds good enough to me. 

https://github.com/llvm/llvm-project/pull/97350


More information about the llvm-commits mailing list