@@ -51,7 +51,7 @@ using namespace sampleprof;
51
51
#define DEBUG_TYPE " samplepgo-reader"
52
52
53
53
// This internal option specifies if the profile uses FS discriminators.
54
- // It only applies to text, binary and compact binary format profiles.
54
+ // It only applies to text, and binary format profiles.
55
55
// For ext-binary format profiles, the flag is set in the summary.
56
56
static cl::opt<bool > ProfileIsFSDisciminator (
57
57
" profile-isfs" , cl::Hidden, cl::init(false ),
@@ -568,14 +568,6 @@ ErrorOr<StringRef> SampleProfileReaderExtBinaryBase::readStringFromTable() {
568
568
return SR;
569
569
}
570
570
571
- ErrorOr<StringRef> SampleProfileReaderCompactBinary::readStringFromTable () {
572
- auto Idx = readStringIndex (NameTable);
573
- if (std::error_code EC = Idx.getError ())
574
- return EC;
575
-
576
- return StringRef (NameTable[*Idx]);
577
- }
578
-
579
571
std::error_code
580
572
SampleProfileReaderBinary::readProfile (FunctionSamples &FProfile) {
581
573
auto NumSamples = readNumber<uint64_t >();
@@ -1012,40 +1004,6 @@ std::error_code SampleProfileReaderExtBinaryBase::readImpl() {
1012
1004
return sampleprof_error::success;
1013
1005
}
1014
1006
1015
- std::error_code SampleProfileReaderCompactBinary::readImpl () {
1016
- // Collect functions used by current module if the Reader has been
1017
- // given a module.
1018
- bool LoadFuncsToBeUsed = collectFuncsFromModule ();
1019
- ProfileIsFS = ProfileIsFSDisciminator;
1020
- FunctionSamples::ProfileIsFS = ProfileIsFS;
1021
- std::vector<uint64_t > OffsetsToUse;
1022
- if (!LoadFuncsToBeUsed) {
1023
- // load all the function profiles.
1024
- for (auto FuncEntry : FuncOffsetTable) {
1025
- OffsetsToUse.push_back (FuncEntry.second );
1026
- }
1027
- } else {
1028
- // load function profiles on demand.
1029
- for (auto Name : FuncsToUse) {
1030
- auto GUID = std::to_string (MD5Hash (Name));
1031
- auto iter = FuncOffsetTable.find (StringRef (GUID));
1032
- if (iter == FuncOffsetTable.end ())
1033
- continue ;
1034
- OffsetsToUse.push_back (iter->second );
1035
- }
1036
- }
1037
-
1038
- for (auto Offset : OffsetsToUse) {
1039
- const uint8_t *SavedData = Data;
1040
- if (std::error_code EC = readFuncProfile (
1041
- reinterpret_cast <const uint8_t *>(Buffer->getBufferStart ()) +
1042
- Offset))
1043
- return EC;
1044
- Data = SavedData;
1045
- }
1046
- return sampleprof_error::success;
1047
- }
1048
-
1049
1007
std::error_code SampleProfileReaderRawBinary::verifySPMagic (uint64_t Magic) {
1050
1008
if (Magic == SPMagic ())
1051
1009
return sampleprof_error::success;
@@ -1058,13 +1016,6 @@ std::error_code SampleProfileReaderExtBinary::verifySPMagic(uint64_t Magic) {
1058
1016
return sampleprof_error::bad_magic;
1059
1017
}
1060
1018
1061
- std::error_code
1062
- SampleProfileReaderCompactBinary::verifySPMagic (uint64_t Magic) {
1063
- if (Magic == SPMagic (SPF_Compact_Binary))
1064
- return sampleprof_error::success;
1065
- return sampleprof_error::bad_magic;
1066
- }
1067
-
1068
1019
std::error_code SampleProfileReaderBinary::readNameTable () {
1069
1020
auto Size = readNumber<size_t >();
1070
1021
if (std::error_code EC = Size.getError ())
@@ -1234,20 +1185,6 @@ SampleProfileReaderExtBinaryBase::readFuncMetadata(bool ProfileHasAttribute) {
1234
1185
return sampleprof_error::success;
1235
1186
}
1236
1187
1237
- std::error_code SampleProfileReaderCompactBinary::readNameTable () {
1238
- auto Size = readNumber<uint64_t >();
1239
- if (std::error_code EC = Size.getError ())
1240
- return EC;
1241
- NameTable.reserve (*Size);
1242
- for (uint64_t I = 0 ; I < *Size; ++I) {
1243
- auto FID = readNumber<uint64_t >();
1244
- if (std::error_code EC = FID.getError ())
1245
- return EC;
1246
- NameTable.push_back (std::to_string (*FID));
1247
- }
1248
- return sampleprof_error::success;
1249
- }
1250
-
1251
1188
std::error_code
1252
1189
SampleProfileReaderExtBinaryBase::readSecHdrTableEntry (uint64_t Idx) {
1253
1190
SecHdrTableEntry Entry;
@@ -1427,54 +1364,6 @@ std::error_code SampleProfileReaderBinary::readHeader() {
1427
1364
return sampleprof_error::success;
1428
1365
}
1429
1366
1430
- std::error_code SampleProfileReaderCompactBinary::readHeader () {
1431
- SampleProfileReaderBinary::readHeader ();
1432
- if (std::error_code EC = readFuncOffsetTable ())
1433
- return EC;
1434
- return sampleprof_error::success;
1435
- }
1436
-
1437
- std::error_code SampleProfileReaderCompactBinary::readFuncOffsetTable () {
1438
- auto TableOffset = readUnencodedNumber<uint64_t >();
1439
- if (std::error_code EC = TableOffset.getError ())
1440
- return EC;
1441
-
1442
- const uint8_t *SavedData = Data;
1443
- const uint8_t *TableStart =
1444
- reinterpret_cast <const uint8_t *>(Buffer->getBufferStart ()) +
1445
- *TableOffset;
1446
- Data = TableStart;
1447
-
1448
- auto Size = readNumber<uint64_t >();
1449
- if (std::error_code EC = Size.getError ())
1450
- return EC;
1451
-
1452
- FuncOffsetTable.reserve (*Size);
1453
- for (uint64_t I = 0 ; I < *Size; ++I) {
1454
- auto FName (readStringFromTable ());
1455
- if (std::error_code EC = FName.getError ())
1456
- return EC;
1457
-
1458
- auto Offset = readNumber<uint64_t >();
1459
- if (std::error_code EC = Offset.getError ())
1460
- return EC;
1461
-
1462
- FuncOffsetTable[*FName] = *Offset;
1463
- }
1464
- End = TableStart;
1465
- Data = SavedData;
1466
- return sampleprof_error::success;
1467
- }
1468
-
1469
- bool SampleProfileReaderCompactBinary::collectFuncsFromModule () {
1470
- if (!M)
1471
- return false ;
1472
- FuncsToUse.clear ();
1473
- for (auto &F : *M)
1474
- FuncsToUse.insert (FunctionSamples::getCanonicalFnName (F));
1475
- return true ;
1476
- }
1477
-
1478
1367
std::error_code SampleProfileReaderBinary::readSummaryEntry (
1479
1368
std::vector<ProfileSummaryEntry> &Entries) {
1480
1369
auto Cutoff = readNumber<uint64_t >();
@@ -1545,13 +1434,6 @@ bool SampleProfileReaderExtBinary::hasFormat(const MemoryBuffer &Buffer) {
1545
1434
return Magic == SPMagic (SPF_Ext_Binary);
1546
1435
}
1547
1436
1548
- bool SampleProfileReaderCompactBinary::hasFormat (const MemoryBuffer &Buffer) {
1549
- const uint8_t *Data =
1550
- reinterpret_cast <const uint8_t *>(Buffer.getBufferStart ());
1551
- uint64_t Magic = decodeULEB128 (Data);
1552
- return Magic == SPMagic (SPF_Compact_Binary);
1553
- }
1554
-
1555
1437
std::error_code SampleProfileReaderGCC::skipNextWord () {
1556
1438
uint32_t dummy;
1557
1439
if (!GcovBuffer.readInt (dummy))
@@ -1803,7 +1685,7 @@ void SampleProfileReaderItaniumRemapper::applyRemapping(LLVMContext &Ctx) {
1803
1685
Ctx.diagnose (DiagnosticInfoSampleProfile (
1804
1686
Reader.getBuffer ()->getBufferIdentifier (),
1805
1687
" Profile data remapping cannot be applied to profile data "
1806
- " in compact format (original mangled names are not available)." ,
1688
+ " using MD5 names (original mangled names are not available)." ,
1807
1689
DS_Warning));
1808
1690
return ;
1809
1691
}
@@ -1934,8 +1816,6 @@ SampleProfileReader::create(std::unique_ptr<MemoryBuffer> &B, LLVMContext &C,
1934
1816
Reader.reset (new SampleProfileReaderRawBinary (std::move (B), C));
1935
1817
else if (SampleProfileReaderExtBinary::hasFormat (*B))
1936
1818
Reader.reset (new SampleProfileReaderExtBinary (std::move (B), C));
1937
- else if (SampleProfileReaderCompactBinary::hasFormat (*B))
1938
- Reader.reset (new SampleProfileReaderCompactBinary (std::move (B), C));
1939
1819
else if (SampleProfileReaderGCC::hasFormat (*B))
1940
1820
Reader.reset (new SampleProfileReaderGCC (std::move (B), C));
1941
1821
else if (SampleProfileReaderText::hasFormat (*B))
0 commit comments