X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=lib%2FProfileData%2FInstrProfReader.cpp;h=da68242b4617ca86dbc128c650d197a2badae9f4;hp=394893d3701c2b9a1b7d8c4de51b5ac65d8a34d2;hb=6f139ce20bc911456a8edcaabd408e09bd41c806;hpb=ee256944c571b4be88fc7a17b6f9578a09bfd274 diff --git a/lib/ProfileData/InstrProfReader.cpp b/lib/ProfileData/InstrProfReader.cpp index 394893d3701..da68242b461 100644 --- a/lib/ProfileData/InstrProfReader.cpp +++ b/lib/ProfileData/InstrProfReader.cpp @@ -207,7 +207,6 @@ std::error_code RawInstrProfReader::readHeader( CountersDelta = swap(Header.CountersDelta); NamesDelta = swap(Header.NamesDelta); - ValueDataDelta = swap(Header.ValueDataDelta); auto DataSize = swap(Header.DataSize); auto CountersSize = swap(Header.CountersSize); auto NamesSize = swap(Header.NamesSize); @@ -301,11 +300,17 @@ std::error_code RawInstrProfReader::readValueProfilingData(InstrProfRecord &Record) { Record.clearValueData(); - if (!Data->Values || (ValueDataDelta == 0)) + CurValueDataSize = 0; + // Need to match the logic in value profile dumper code in compiler-rt: + uint32_t NumValueKinds = 0; + for (uint32_t I = 0; I < IPVK_Last + 1; I++) + NumValueKinds += (Data->NumValueSites[I] != 0); + + if (!NumValueKinds) return success(); ErrorOr> VDataPtrOrErr = - ValueProfData::getValueProfData(getValueDataCounts(Data->Values), + ValueProfData::getValueProfData(ValueDataStart, (const unsigned char *)ProfileEnd, getDataEndianness()); @@ -313,6 +318,7 @@ RawInstrProfReader::readValueProfilingData(InstrProfRecord &Record) { return VDataPtrOrErr.getError(); VDataPtrOrErr.get()->deserializeTo(Record, &FunctionPtrToNameMap); + CurValueDataSize = VDataPtrOrErr.get()->getSize(); return success(); }