diff options
author | Xinliang David Li <davidxl@google.com> | 2015-12-02 21:48:22 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2015-12-02 21:48:22 +0000 |
commit | a162aab2e3b4c4c6992c97bbbcb7fbf26cd881de (patch) | |
tree | a4d918fb466494217dc36162063d8bc1b5776b25 /lib/profile/InstrProfData.inc | |
parent | 61adea864d5cb3a290cb78950a98be5cb91e1f9c (diff) |
Sync up with master file
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@254552 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/profile/InstrProfData.inc')
-rw-r--r-- | lib/profile/InstrProfData.inc | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/profile/InstrProfData.inc b/lib/profile/InstrProfData.inc index 8ff7003a0..aefdbc1b3 100644 --- a/lib/profile/InstrProfData.inc +++ b/lib/profile/InstrProfData.inc @@ -291,6 +291,7 @@ typedef struct ValueProfData { */ void deserializeTo(InstrProfRecord &Record, InstrProfRecord::ValueMapType *VMap); + void operator delete(void *ptr) { ::operator delete(ptr); } #endif } ValueProfData; @@ -537,12 +538,13 @@ int initializeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord, } NumValueKinds++; RuntimeRecord->SiteCountArray[I] = (uint8_t *)calloc(N, 1); - RuntimeRecord->NodesKind[I] = &RuntimeRecord->Nodes[S]; - if (!RuntimeRecord->NodesKind[I]) + if (!RuntimeRecord->SiteCountArray[I]) return 1; + RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : NULL; for (J = 0; J < N; J++) { + /* Compute value count for each site. */ uint32_t C = 0; - ValueProfNode *Site = RuntimeRecord->Nodes[S + J]; + ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind[I][J] : NULL; while (Site) { C++; Site = Site->Next; @@ -595,6 +597,8 @@ void getValueForSiteRT(const void *R, InstrProfValueData *Dst, uint32_t VK, unsigned I, N = 0; const ValueProfRuntimeRecord *Record = (const ValueProfRuntimeRecord *)R; N = getNumValueDataForSiteRT(R, VK, S); + if (N == 0) + return; ValueProfNode *VNode = Record->NodesKind[VK][S]; for (I = 0; I < N; I++) { Dst[I] = VNode->VData; |