diff options
author | Amara Emerson <aemerson@apple.com> | 2019-09-21 09:11:51 +0000 |
---|---|---|
committer | Amara Emerson <aemerson@apple.com> | 2019-09-21 09:11:51 +0000 |
commit | 3bb56fa4789095631074d42dc61e1c1536342f8c (patch) | |
tree | 3f061dc79db1b852fd81c1b335c4746ba76ea2ae | |
parent | 8a74eca398a012a9b3b18b10c2b5aedef203d04b (diff) | |
download | bcm5719-llvm-3bb56fa4789095631074d42dc61e1c1536342f8c.tar.gz bcm5719-llvm-3bb56fa4789095631074d42dc61e1c1536342f8c.zip |
Revert "[SampleFDO] Expose an interface to return the size of a section or the size"
This reverts commit f118852046a1d255ed8c65c6b5db320e8cea53a0.
Broke the macOS build/greendragon bots.
llvm-svn: 372464
-rw-r--r-- | llvm/include/llvm/ProfileData/SampleProf.h | 16 | ||||
-rw-r--r-- | llvm/include/llvm/ProfileData/SampleProfReader.h | 7 | ||||
-rw-r--r-- | llvm/lib/ProfileData/SampleProfReader.cpp | 30 | ||||
-rw-r--r-- | llvm/test/tools/llvm-profdata/show-prof-size.test | 7 | ||||
-rw-r--r-- | llvm/tools/llvm-profdata/llvm-profdata.cpp | 27 |
5 files changed, 2 insertions, 85 deletions
diff --git a/llvm/include/llvm/ProfileData/SampleProf.h b/llvm/include/llvm/ProfileData/SampleProf.h index 9ad740ed804..157c79f6772 100644 --- a/llvm/include/llvm/ProfileData/SampleProf.h +++ b/llvm/include/llvm/ProfileData/SampleProf.h @@ -125,22 +125,6 @@ enum SecType { SecLBRProfile = SecFuncProfileFirst }; -static inline std::string getSecName(SecType Type) { - switch (Type) { - case SecInValid: - return "InvalidSection"; - case SecProfSummary: - return "ProfileSummarySection"; - case SecNameTable: - return "NameTableSection"; - case SecProfileSymbolList: - return "ProfileSymbolListSection"; - case SecLBRProfile: - return "LBRProfileSection"; - } - llvm_unreachable("A SecType has no name for output"); -} - // Entry type of section header table used by SampleProfileExtBinaryBaseReader // and SampleProfileExtBinaryBaseWriter. struct SecHdrTableEntry { diff --git a/llvm/include/llvm/ProfileData/SampleProfReader.h b/llvm/include/llvm/ProfileData/SampleProfReader.h index 761dbde0595..3d5134d7749 100644 --- a/llvm/include/llvm/ProfileData/SampleProfReader.h +++ b/llvm/include/llvm/ProfileData/SampleProfReader.h @@ -333,7 +333,6 @@ public: /// It includes all the names that have samples either in outline instance /// or inline instance. virtual std::vector<StringRef> *getNameTable() { return nullptr; } - virtual bool dumpSectionInfo(raw_ostream &OS = dbgs()) { return false; }; protected: /// Map every function to its associated profile. @@ -505,12 +504,6 @@ public: /// Read sample profiles in extensible format from the associated file. std::error_code read() override; - - /// Get the total size of all \p Type sections. - uint64_t getSectionSize(SecType Type); - /// Get the total size of header and all sections. - uint64_t getFileSize(); - virtual bool dumpSectionInfo(raw_ostream &OS = dbgs()) override; }; class SampleProfileReaderExtBinary : public SampleProfileReaderExtBinaryBase { diff --git a/llvm/lib/ProfileData/SampleProfReader.cpp b/llvm/lib/ProfileData/SampleProfReader.cpp index 07272ebac0a..f6b33d96261 100644 --- a/llvm/lib/ProfileData/SampleProfReader.cpp +++ b/llvm/lib/ProfileData/SampleProfReader.cpp @@ -667,36 +667,6 @@ std::error_code SampleProfileReaderExtBinaryBase::readHeader() { return sampleprof_error::success; } -uint64_t SampleProfileReaderExtBinaryBase::getSectionSize(SecType Type) { - for (auto &Entry : SecHdrTable) { - if (Entry.Type == Type) - return Entry.Size; - } - return 0; -} - -uint64_t SampleProfileReaderExtBinaryBase::getFileSize() { - auto &LastEntry = SecHdrTable.back(); - return LastEntry.Offset + LastEntry.Size; -} - -bool SampleProfileReaderExtBinaryBase::dumpSectionInfo(raw_ostream &OS) { - uint64_t TotalSecsSize = 0; - for (auto &Entry : SecHdrTable) { - OS << getSecName(Entry.Type) << " - Offset: " << Entry.Offset - << ", Size: " << Entry.Size << "\n"; - TotalSecsSize += getSectionSize(Entry.Type); - } - uint64_t HeaderSize = SecHdrTable.front().Offset; - assert(HeaderSize + TotalSecsSize == getFileSize() && - "Size of 'header + sections' doesn't match the total size of profile"); - - OS << "Header Size: " << HeaderSize << "\n"; - OS << "Total Sections Size: " << TotalSecsSize << "\n"; - OS << "File Size: " << getFileSize() << "\n"; - return true; -} - std::error_code SampleProfileReaderBinary::readMagicIdent() { // Read and check the magic identifier. auto Magic = readNumber<uint64_t>(); diff --git a/llvm/test/tools/llvm-profdata/show-prof-size.test b/llvm/test/tools/llvm-profdata/show-prof-size.test deleted file mode 100644 index 0d1ecdcfd67..00000000000 --- a/llvm/test/tools/llvm-profdata/show-prof-size.test +++ /dev/null @@ -1,7 +0,0 @@ -; RUN: llvm-profdata merge -sample -extbinary -prof-sym-list=%S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile.proftext -o %t.1.output -; RUN: ls -l %t.1.output |cut -f5 -d ' ' > %t.txt -; RUN: llvm-profdata show -sample -show-sec-info-only %t.1.output >> %t.txt -; RUN: FileCheck %s --input-file=%t.txt -; Check llvm-profdata shows the correct file size. -; CHECK: [[FILESIZE:.*]] -; CHECK: [[FILESIZE]] diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 2b1205b950f..4f825dfb5b8 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -982,21 +982,10 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts, return 0; } -static void showSectionInfo(sampleprof::SampleProfileReader *Reader, - raw_fd_ostream &OS) { - if (!Reader->dumpSectionInfo(OS)) { - WithColor::warning() << "-show-sec-info-only is only supported for " - << "sample profile in extbinary format and is " - << "ignored for other formats.\n"; - return; - } -} - static int showSampleProfile(const std::string &Filename, bool ShowCounts, bool ShowAllFunctions, const std::string &ShowFunction, - bool ShowProfileSymbolList, - bool ShowSectionInfoOnly, raw_fd_ostream &OS) { + bool ShowProfileSymbolList, raw_fd_ostream &OS) { using namespace sampleprof; LLVMContext Context; auto ReaderOrErr = SampleProfileReader::create(Filename, Context); @@ -1004,12 +993,6 @@ static int showSampleProfile(const std::string &Filename, bool ShowCounts, exitWithErrorCode(EC, Filename); auto Reader = std::move(ReaderOrErr.get()); - - if (ShowSectionInfoOnly) { - showSectionInfo(Reader.get(), OS); - return 0; - } - if (std::error_code EC = Reader->read()) exitWithErrorCode(EC, Filename); @@ -1079,11 +1062,6 @@ static int show_main(int argc, const char *argv[]) { cl::opt<bool> ShowProfileSymbolList( "show-prof-sym-list", cl::init(false), cl::desc("Show profile symbol list if it exists in the profile. ")); - cl::opt<bool> ShowSectionInfoOnly( - "show-sec-info-only", cl::init(false), - cl::desc("Show the information of each section in the sample profile. " - "The flag is only usable when the sample profile is in " - "extbinary format")); cl::ParseCommandLineOptions(argc, argv, "LLVM profile data summary\n"); @@ -1112,8 +1090,7 @@ static int show_main(int argc, const char *argv[]) { OnlyListBelow, ShowFunction, TextFormat, OS); else return showSampleProfile(Filename, ShowCounts, ShowAllFunctions, - ShowFunction, ShowProfileSymbolList, - ShowSectionInfoOnly, OS); + ShowFunction, ShowProfileSymbolList, OS); } int main(int argc, const char *argv[]) { |