summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXinliang David Li <davidxl@google.com>2016-05-11 21:17:10 +0000
committerXinliang David Li <davidxl@google.com>2016-05-11 21:17:10 +0000
commit50f240a42487c18bfb3f879d4226fd3884660c33 (patch)
treefea1d7b521b9387ee77e535fdaa39ad398c21c51
parenteb836a3dec78290d4e42aa1917d6583f8ef84a72 (diff)
downloadbcm5719-llvm-50f240a42487c18bfb3f879d4226fd3884660c33.tar.gz
bcm5719-llvm-50f240a42487c18bfb3f879d4226fd3884660c33.zip
cleanup: do not recompute size for preallocated buffer
llvm-svn: 269238
-rw-r--r--llvm/include/llvm/ProfileData/InstrProfData.inc7
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/include/llvm/ProfileData/InstrProfData.inc b/llvm/include/llvm/ProfileData/InstrProfData.inc
index 043788b8137..6db5caeeb38 100644
--- a/llvm/include/llvm/ProfileData/InstrProfData.inc
+++ b/llvm/include/llvm/ProfileData/InstrProfData.inc
@@ -531,12 +531,15 @@ void serializeValueProfRecordFrom(ValueProfRecord *This,
/*!
* 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);
OpenPOWER on IntegriCloud