aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
diff options
context:
space:
mode:
authorGulfem Savrun Yeniceri <gulfem@google.com>2022-10-05 01:54:04 +0000
committerGulfem Savrun Yeniceri <gulfem@google.com>2022-10-06 17:02:16 +0000
commitda594649fe302bc4cd031e85af6dc43d82d8e334 (patch)
tree3706d58818c97be3285b5119e2df7f31c5afbef9 /llvm/tools/llvm-profdata/llvm-profdata.cpp
parent9409bbb2e0527336f8a6f163b1a5a791f4556e95 (diff)
downloadllvm-da594649fe302bc4cd031e85af6dc43d82d8e334.zip
llvm-da594649fe302bc4cd031e85af6dc43d82d8e334.tar.gz
llvm-da594649fe302bc4cd031e85af6dc43d82d8e334.tar.bz2
[InstrProf] Add version into llvm-profdata
This patch adds support of printing profile version into llvm-profdata which was proposed in: https://discourse.llvm.org/t/llvm-profdata-failure-guarantees-for-code-coverage/64924 Differential Revision: https://reviews.llvm.org/D135317
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 95a5fc4..ab20782 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -2252,7 +2252,7 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts,
uint64_t ValueCutoff, bool OnlyListBelow,
const std::string &ShowFunction, bool TextFormat,
bool ShowBinaryIds, bool ShowCovered,
- raw_fd_ostream &OS) {
+ bool ShowProfileVersion, raw_fd_ostream &OS) {
auto ReaderOrErr = InstrProfReader::create(Filename);
std::vector<uint32_t> Cutoffs = std::move(DetailedSummaryCutoffs);
if (ShowDetailedSummary && Cutoffs.empty()) {
@@ -2462,6 +2462,8 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts,
if (Error E = Reader->printBinaryIds(OS))
exitWithError(std::move(E), Filename);
+ if (ShowProfileVersion)
+ OS << "Profile version: " << Reader->getVersion() << "\n";
return 0;
}
@@ -2786,7 +2788,8 @@ static int show_main(int argc, const char *argv[]) {
cl::opt<std::string> ProfiledBinary(
"profiled-binary", cl::init(""),
cl::desc("Path to binary from which the profile was collected."));
-
+ cl::opt<bool> ShowProfileVersion("profile-version", cl::init(false),
+ cl::desc("Show profile version. "));
cl::ParseCommandLineOptions(argc, argv, "LLVM profile data summary\n");
if (Filename.empty() && DebugInfoFilename.empty())
@@ -2817,7 +2820,7 @@ static int show_main(int argc, const char *argv[]) {
Filename, ShowCounts, TopNFunctions, ShowIndirectCallTargets,
ShowMemOPSizes, ShowDetailedSummary, DetailedSummaryCutoffs,
ShowAllFunctions, ShowCS, ValueCutoff, OnlyListBelow, ShowFunction,
- TextFormat, ShowBinaryIds, ShowCovered, OS);
+ TextFormat, ShowBinaryIds, ShowCovered, ShowProfileVersion, OS);
if (ProfileKind == sample)
return showSampleProfile(
Filename, ShowCounts, TopNFunctions, ShowAllFunctions,