diff options
author | Xinliang David Li <davidxl@google.com> | 2015-12-02 21:47:43 +0000 |
---|---|---|
committer | Xinliang David Li <davidxl@google.com> | 2015-12-02 21:47:43 +0000 |
commit | ed192380fc0f73545d2eac8f18d07b7fb344c0db (patch) | |
tree | 52741fe18ec26e8d793a394465516ef773d236cb /include | |
parent | aaaedd7f8f7d68b41ad3845d050365c03163942f (diff) |
[PGO] Allow input value node list to be null
This is to handle the case when vp node linked
list array is laziliy initialized at runtime
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@254551 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ProfileData/InstrProfData.inc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/include/llvm/ProfileData/InstrProfData.inc b/include/llvm/ProfileData/InstrProfData.inc index a2f0a8ae684..aefdbc1b3e4 100644 --- a/include/llvm/ProfileData/InstrProfData.inc +++ b/include/llvm/ProfileData/InstrProfData.inc @@ -538,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; @@ -596,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; |