[llvm] r269238 - cleanup: do not recompute size for preallocated buffer
Xinliang David Li via llvm-commits
llvm-commits at lists.llvm.org
Wed May 11 14:17:10 PDT 2016
Author: davidxl
Date: Wed May 11 16:17:10 2016
New Revision: 269238
URL: http://llvm.org/viewvc/llvm-project?rev=269238&view=rev
Log:
cleanup: do not recompute size for preallocated buffer
Modified:
llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
Modified: llvm/trunk/include/llvm/ProfileData/InstrProfData.inc
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ProfileData/InstrProfData.inc?rev=269238&r1=269237&r2=269238&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ProfileData/InstrProfData.inc (original)
+++ llvm/trunk/include/llvm/ProfileData/InstrProfData.inc Wed May 11 16:17:10 2016
@@ -531,12 +531,15 @@ void serializeValueProfRecordFrom(ValueP
/*!
* Extract value profile data of a function from the \c Closure
* and serialize the data into \c DstData if it is not NULL or heap
- * memory allocated by the \c Closure's allocator method.
+ * memory allocated by the \c Closure's allocator method. If \c
+ * DstData is not null, the caller is expected to set the TotalSize
+ * in DstData.
*/
ValueProfData *serializeValueProfDataFrom(ValueProfRecordClosure *Closure,
ValueProfData *DstData) {
uint32_t Kind;
- uint32_t TotalSize = getValueProfDataSize(Closure);
+ uint32_t TotalSize =
+ DstData ? DstData->TotalSize : getValueProfDataSize(Closure);
ValueProfData *VPD =
DstData ? DstData : Closure->AllocValueProfData(TotalSize);
More information about the llvm-commits
mailing list