forked from OSchip/llvm-project
[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 llvm-svn: 254551
This commit is contained in:
parent
c84311163a
commit
f7861b7a09
|
@ -538,12 +538,13 @@ int initializeValueProfRuntimeRecord(ValueProfRuntimeRecord *RuntimeRecord,
|
||||||
}
|
}
|
||||||
NumValueKinds++;
|
NumValueKinds++;
|
||||||
RuntimeRecord->SiteCountArray[I] = (uint8_t *)calloc(N, 1);
|
RuntimeRecord->SiteCountArray[I] = (uint8_t *)calloc(N, 1);
|
||||||
RuntimeRecord->NodesKind[I] = &RuntimeRecord->Nodes[S];
|
if (!RuntimeRecord->SiteCountArray[I])
|
||||||
if (!RuntimeRecord->NodesKind[I])
|
|
||||||
return 1;
|
return 1;
|
||||||
|
RuntimeRecord->NodesKind[I] = Nodes ? &Nodes[S] : NULL;
|
||||||
for (J = 0; J < N; J++) {
|
for (J = 0; J < N; J++) {
|
||||||
|
/* Compute value count for each site. */
|
||||||
uint32_t C = 0;
|
uint32_t C = 0;
|
||||||
ValueProfNode *Site = RuntimeRecord->Nodes[S + J];
|
ValueProfNode *Site = Nodes ? RuntimeRecord->NodesKind[I][J] : NULL;
|
||||||
while (Site) {
|
while (Site) {
|
||||||
C++;
|
C++;
|
||||||
Site = Site->Next;
|
Site = Site->Next;
|
||||||
|
@ -596,6 +597,8 @@ void getValueForSiteRT(const void *R, InstrProfValueData *Dst, uint32_t VK,
|
||||||
unsigned I, N = 0;
|
unsigned I, N = 0;
|
||||||
const ValueProfRuntimeRecord *Record = (const ValueProfRuntimeRecord *)R;
|
const ValueProfRuntimeRecord *Record = (const ValueProfRuntimeRecord *)R;
|
||||||
N = getNumValueDataForSiteRT(R, VK, S);
|
N = getNumValueDataForSiteRT(R, VK, S);
|
||||||
|
if (N == 0)
|
||||||
|
return;
|
||||||
ValueProfNode *VNode = Record->NodesKind[VK][S];
|
ValueProfNode *VNode = Record->NodesKind[VK][S];
|
||||||
for (I = 0; I < N; I++) {
|
for (I = 0; I < N; I++) {
|
||||||
Dst[I] = VNode->VData;
|
Dst[I] = VNode->VData;
|
||||||
|
|
Loading…
Reference in New Issue