aboutsummaryrefslogtreecommitdiff
path: root/llvm/tools/llvm-profdata/llvm-profdata.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/tools/llvm-profdata/llvm-profdata.cpp')
-rw-r--r--llvm/tools/llvm-profdata/llvm-profdata.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/llvm/tools/llvm-profdata/llvm-profdata.cpp b/llvm/tools/llvm-profdata/llvm-profdata.cpp
index 9da5368..d4266fb 100644
--- a/llvm/tools/llvm-profdata/llvm-profdata.cpp
+++ b/llvm/tools/llvm-profdata/llvm-profdata.cpp
@@ -407,8 +407,8 @@ static void
mergeInstrProfile(const WeightedFileVector &Inputs, StringRef DebugInfoFilename,
SymbolRemapper *Remapper, StringRef OutputFilename,
ProfileFormat OutputFormat, uint64_t TraceReservoirSize,
- uint64_t MaxTraceLength, bool OutputSparse,
- unsigned NumThreads, FailureMode FailMode,
+ uint64_t MaxTraceLength, int MaxDbgCorrelationWarnings,
+ bool OutputSparse, unsigned NumThreads, FailureMode FailMode,
const StringRef ProfiledBinary) {
if (OutputFormat == PF_Compact_Binary)
exitWithError("Compact Binary is deprecated");
@@ -421,7 +421,7 @@ mergeInstrProfile(const WeightedFileVector &Inputs, StringRef DebugInfoFilename,
if (auto Err =
InstrProfCorrelator::get(DebugInfoFilename).moveInto(Correlator))
exitWithError(std::move(Err), DebugInfoFilename);
- if (auto Err = Correlator->correlateProfileData())
+ if (auto Err = Correlator->correlateProfileData(MaxDbgCorrelationWarnings))
exitWithError(std::move(Err), DebugInfoFilename);
}
@@ -1270,6 +1270,11 @@ static int merge_main(int argc, const char *argv[]) {
cl::opt<std::string> DebugInfoFilename(
"debug-info", cl::init(""),
cl::desc("Use the provided debug info to correlate the raw profile."));
+ cl::opt<unsigned> MaxDbgCorrelationWarnings(
+ "max-debug-info-correlation-warnings",
+ cl::desc("The maximum number of warnings to emit when correlating "
+ "profile from debug info (0 = no limit)"),
+ cl::init(5));
cl::opt<std::string> ProfiledBinary(
"profiled-binary", cl::init(""),
cl::desc("Path to binary from which the profile was collected."));
@@ -1331,8 +1336,8 @@ static int merge_main(int argc, const char *argv[]) {
mergeInstrProfile(WeightedInputs, DebugInfoFilename, Remapper.get(),
OutputFilename, OutputFormat,
TemporalProfTraceReservoirSize,
- TemporalProfMaxTraceLength, OutputSparse, NumThreads,
- FailureMode, ProfiledBinary);
+ TemporalProfMaxTraceLength, MaxDbgCorrelationWarnings,
+ OutputSparse, NumThreads, FailureMode, ProfiledBinary);
else
mergeSampleProfile(WeightedInputs, Remapper.get(), OutputFilename,
OutputFormat, ProfileSymbolListFile, CompressAllSections,
@@ -2877,6 +2882,7 @@ static int showMemProfProfile(const std::string &Filename,
static int showDebugInfoCorrelation(const std::string &Filename,
bool ShowDetailedSummary,
bool ShowProfileSymbolList,
+ int MaxDbgCorrelationWarnings,
ShowFormat SFormat, raw_fd_ostream &OS) {
if (SFormat == ShowFormat::Json)
exitWithError("JSON output is not supported for debug info correlation");
@@ -2884,12 +2890,12 @@ static int showDebugInfoCorrelation(const std::string &Filename,
if (auto Err = InstrProfCorrelator::get(Filename).moveInto(Correlator))
exitWithError(std::move(Err), Filename);
if (SFormat == ShowFormat::Yaml) {
- if (auto Err = Correlator->dumpYaml(OS))
+ if (auto Err = Correlator->dumpYaml(MaxDbgCorrelationWarnings, OS))
exitWithError(std::move(Err), Filename);
return 0;
}
- if (auto Err = Correlator->correlateProfileData())
+ if (auto Err = Correlator->correlateProfileData(MaxDbgCorrelationWarnings))
exitWithError(std::move(Err), Filename);
InstrProfSymtab Symtab;
@@ -2989,6 +2995,11 @@ 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<unsigned> MaxDbgCorrelationWarnings(
+ "max-debug-info-correlation-warnings",
+ cl::desc("The maximum number of warnings to emit when correlating "
+ "profile from debug info (0 = no limit)"),
+ cl::init(5));
cl::opt<bool> ShowCovered(
"covered", cl::init(false),
cl::desc("Show only the functions that have been executed."));
@@ -3022,7 +3033,8 @@ static int show_main(int argc, const char *argv[]) {
if (!DebugInfoFilename.empty())
return showDebugInfoCorrelation(DebugInfoFilename, ShowDetailedSummary,
- ShowProfileSymbolList, SFormat, OS);
+ ShowProfileSymbolList,
+ MaxDbgCorrelationWarnings, SFormat, OS);
if (ProfileKind == instr)
return showInstrProfile(