Skip to content

Commit 3bb56fa

Browse files
committed
Revert "[SampleFDO] Expose an interface to return the size of a section or the size"
This reverts commit f118852. Broke the macOS build/greendragon bots. llvm-svn: 372464
1 parent 8a74eca commit 3bb56fa

File tree

5 files changed

+2
-85
lines changed

5 files changed

+2
-85
lines changed

llvm/include/llvm/ProfileData/SampleProf.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,22 +125,6 @@ enum SecType {
125125
SecLBRProfile = SecFuncProfileFirst
126126
};
127127

128-
static inline std::string getSecName(SecType Type) {
129-
switch (Type) {
130-
case SecInValid:
131-
return "InvalidSection";
132-
case SecProfSummary:
133-
return "ProfileSummarySection";
134-
case SecNameTable:
135-
return "NameTableSection";
136-
case SecProfileSymbolList:
137-
return "ProfileSymbolListSection";
138-
case SecLBRProfile:
139-
return "LBRProfileSection";
140-
}
141-
llvm_unreachable("A SecType has no name for output");
142-
}
143-
144128
// Entry type of section header table used by SampleProfileExtBinaryBaseReader
145129
// and SampleProfileExtBinaryBaseWriter.
146130
struct SecHdrTableEntry {

llvm/include/llvm/ProfileData/SampleProfReader.h

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,6 @@ class SampleProfileReader {
333333
/// It includes all the names that have samples either in outline instance
334334
/// or inline instance.
335335
virtual std::vector<StringRef> *getNameTable() { return nullptr; }
336-
virtual bool dumpSectionInfo(raw_ostream &OS = dbgs()) { return false; };
337336

338337
protected:
339338
/// Map every function to its associated profile.
@@ -505,12 +504,6 @@ class SampleProfileReaderExtBinaryBase : public SampleProfileReaderBinary {
505504

506505
/// Read sample profiles in extensible format from the associated file.
507506
std::error_code read() override;
508-
509-
/// Get the total size of all \p Type sections.
510-
uint64_t getSectionSize(SecType Type);
511-
/// Get the total size of header and all sections.
512-
uint64_t getFileSize();
513-
virtual bool dumpSectionInfo(raw_ostream &OS = dbgs()) override;
514507
};
515508

516509
class SampleProfileReaderExtBinary : public SampleProfileReaderExtBinaryBase {

llvm/lib/ProfileData/SampleProfReader.cpp

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -667,36 +667,6 @@ std::error_code SampleProfileReaderExtBinaryBase::readHeader() {
667667
return sampleprof_error::success;
668668
}
669669

670-
uint64_t SampleProfileReaderExtBinaryBase::getSectionSize(SecType Type) {
671-
for (auto &Entry : SecHdrTable) {
672-
if (Entry.Type == Type)
673-
return Entry.Size;
674-
}
675-
return 0;
676-
}
677-
678-
uint64_t SampleProfileReaderExtBinaryBase::getFileSize() {
679-
auto &LastEntry = SecHdrTable.back();
680-
return LastEntry.Offset + LastEntry.Size;
681-
}
682-
683-
bool SampleProfileReaderExtBinaryBase::dumpSectionInfo(raw_ostream &OS) {
684-
uint64_t TotalSecsSize = 0;
685-
for (auto &Entry : SecHdrTable) {
686-
OS << getSecName(Entry.Type) << " - Offset: " << Entry.Offset
687-
<< ", Size: " << Entry.Size << "\n";
688-
TotalSecsSize += getSectionSize(Entry.Type);
689-
}
690-
uint64_t HeaderSize = SecHdrTable.front().Offset;
691-
assert(HeaderSize + TotalSecsSize == getFileSize() &&
692-
"Size of 'header + sections' doesn't match the total size of profile");
693-
694-
OS << "Header Size: " << HeaderSize << "\n";
695-
OS << "Total Sections Size: " << TotalSecsSize << "\n";
696-
OS << "File Size: " << getFileSize() << "\n";
697-
return true;
698-
}
699-
700670
std::error_code SampleProfileReaderBinary::readMagicIdent() {
701671
// Read and check the magic identifier.
702672
auto Magic = readNumber<uint64_t>();

llvm/test/tools/llvm-profdata/show-prof-size.test

Lines changed: 0 additions & 7 deletions
This file was deleted.

llvm/tools/llvm-profdata/llvm-profdata.cpp

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -982,34 +982,17 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts,
982982
return 0;
983983
}
984984

985-
static void showSectionInfo(sampleprof::SampleProfileReader *Reader,
986-
raw_fd_ostream &OS) {
987-
if (!Reader->dumpSectionInfo(OS)) {
988-
WithColor::warning() << "-show-sec-info-only is only supported for "
989-
<< "sample profile in extbinary format and is "
990-
<< "ignored for other formats.\n";
991-
return;
992-
}
993-
}
994-
995985
static int showSampleProfile(const std::string &Filename, bool ShowCounts,
996986
bool ShowAllFunctions,
997987
const std::string &ShowFunction,
998-
bool ShowProfileSymbolList,
999-
bool ShowSectionInfoOnly, raw_fd_ostream &OS) {
988+
bool ShowProfileSymbolList, raw_fd_ostream &OS) {
1000989
using namespace sampleprof;
1001990
LLVMContext Context;
1002991
auto ReaderOrErr = SampleProfileReader::create(Filename, Context);
1003992
if (std::error_code EC = ReaderOrErr.getError())
1004993
exitWithErrorCode(EC, Filename);
1005994

1006995
auto Reader = std::move(ReaderOrErr.get());
1007-
1008-
if (ShowSectionInfoOnly) {
1009-
showSectionInfo(Reader.get(), OS);
1010-
return 0;
1011-
}
1012-
1013996
if (std::error_code EC = Reader->read())
1014997
exitWithErrorCode(EC, Filename);
1015998

@@ -1079,11 +1062,6 @@ static int show_main(int argc, const char *argv[]) {
10791062
cl::opt<bool> ShowProfileSymbolList(
10801063
"show-prof-sym-list", cl::init(false),
10811064
cl::desc("Show profile symbol list if it exists in the profile. "));
1082-
cl::opt<bool> ShowSectionInfoOnly(
1083-
"show-sec-info-only", cl::init(false),
1084-
cl::desc("Show the information of each section in the sample profile. "
1085-
"The flag is only usable when the sample profile is in "
1086-
"extbinary format"));
10871065

10881066
cl::ParseCommandLineOptions(argc, argv, "LLVM profile data summary\n");
10891067

@@ -1112,8 +1090,7 @@ static int show_main(int argc, const char *argv[]) {
11121090
OnlyListBelow, ShowFunction, TextFormat, OS);
11131091
else
11141092
return showSampleProfile(Filename, ShowCounts, ShowAllFunctions,
1115-
ShowFunction, ShowProfileSymbolList,
1116-
ShowSectionInfoOnly, OS);
1093+
ShowFunction, ShowProfileSymbolList, OS);
11171094
}
11181095

11191096
int main(int argc, const char *argv[]) {

0 commit comments

Comments
 (0)