diff options
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
| -rw-r--r-- | llvm/tools/llvm-profdata/llvm-profdata.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp index 5e58c1365d80..6000460d3c23 100644 --- a/llvm/tools/llvm-profdata/llvm-profdata.cpp +++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp @@ -255,9 +255,7 @@ static void loadInput(const WeightedFile &Input, SymbolRemapper *Remapper, } auto Reader = std::move(ReaderOrErr.get()); - bool IsIRProfile = Reader->isIRLevelProfile(); - bool HasCSIRProfile = Reader->hasCSIRLevelProfile(); - if (Error E = WC->Writer.setIsIRLevelProfile(IsIRProfile, HasCSIRProfile)) { + if (Error E = WC->Writer.mergeProfileKind(Reader->getProfileKind())) { consumeError(std::move(E)); WC->Errors.emplace_back( make_error<StringError>( @@ -266,7 +264,6 @@ static void loadInput(const WeightedFile &Input, SymbolRemapper *Remapper, Filename); return; } - WC->Writer.setInstrEntryBBEnabled(Reader->instrEntryBBEnabled()); for (auto &I : *Reader) { if (Remapper) @@ -2095,7 +2092,8 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts, bool ShowAllFunctions, bool ShowCS, uint64_t ValueCutoff, bool OnlyListBelow, const std::string &ShowFunction, bool TextFormat, - bool ShowBinaryIds, raw_fd_ostream &OS) { + bool ShowBinaryIds, bool ShowCovered, + raw_fd_ostream &OS) { auto ReaderOrErr = InstrProfReader::create(Filename); std::vector<uint32_t> Cutoffs = std::move(DetailedSummaryCutoffs); if (ShowDetailedSummary && Cutoffs.empty()) { @@ -2152,6 +2150,13 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts, assert(Func.Counts.size() > 0 && "function missing entry counter"); Builder.addRecord(Func); + if (ShowCovered) { + if (std::any_of(Func.Counts.begin(), Func.Counts.end(), + [](uint64_t C) { return C; })) + OS << Func.Name << "\n"; + continue; + } + uint64_t FuncMax = 0; uint64_t FuncSum = 0; for (size_t I = 0, E = Func.Counts.size(); I < E; ++I) { @@ -2228,7 +2233,7 @@ static int showInstrProfile(const std::string &Filename, bool ShowCounts, if (Reader->hasError()) exitWithError(Reader->getError(), Filename); - if (TextFormat) + if (TextFormat || ShowCovered) return 0; std::unique_ptr<ProfileSummary> PS(Builder.getSummary()); bool IsIR = Reader->isIRLevelProfile(); @@ -2579,6 +2584,9 @@ static int show_main(int argc, const char *argv[]) { "debug-info", cl::init(""), cl::desc("Read and extract profile metadata from debug info and show " "the functions it found.")); + cl::opt<bool> ShowCovered( + "covered", cl::init(false), + cl::desc("Show only the functions that have been executed.")); cl::ParseCommandLineOptions(argc, argv, "LLVM profile data summary\n"); @@ -2610,7 +2618,7 @@ static int show_main(int argc, const char *argv[]) { Filename, ShowCounts, TopNFunctions, ShowIndirectCallTargets, ShowMemOPSizes, ShowDetailedSummary, DetailedSummaryCutoffs, ShowAllFunctions, ShowCS, ValueCutoff, OnlyListBelow, ShowFunction, - TextFormat, ShowBinaryIds, OS); + TextFormat, ShowBinaryIds, ShowCovered, OS); if (ProfileKind == sample) return showSampleProfile(Filename, ShowCounts, TopNFunctions, ShowAllFunctions, ShowDetailedSummary, |
