[PATCH] D118166: [InstrProf][Correlate] Improve error messages
Ellis Hoag via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 25 16:19:34 PST 2022
ellis created this revision.
Herald added a subscriber: hiraditya.
ellis edited the summary of this revision.
ellis added reviewers: dblaikie, kyulee.
ellis retitled this revision from "[InstrProf][correlation] Improve error messages" to "[InstrProf][Correlate] Improve error messages".
ellis added a comment.
ellis edited reviewers, added: phosek, davidxl; removed: dblaikie.
ellis published this revision for review.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
Tests are in the next diff D118181 <https://reviews.llvm.org/D118181>
Improve the error messages when using `llvm-profdata` to correlate profiles with debug info.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D118166
Files:
llvm/include/llvm/ProfileData/InstrProf.h
llvm/lib/ProfileData/InstrProf.cpp
llvm/lib/ProfileData/InstrProfCorrelator.cpp
Index: llvm/lib/ProfileData/InstrProfCorrelator.cpp
===================================================================
--- llvm/lib/ProfileData/InstrProfCorrelator.cpp
+++ llvm/lib/ProfileData/InstrProfCorrelator.cpp
@@ -23,7 +23,8 @@
if (SectionName.get() == INSTR_PROF_CNTS_SECT_NAME)
return Section;
return make_error<InstrProfError>(
- instrprof_error::unable_to_correlate_profile);
+ instrprof_error::unable_to_correlate_profile,
+ "could not find counter section (" INSTR_PROF_CNTS_SECT_NAME ")");
}
const char *InstrProfCorrelator::FunctionNameAttributeName = "Function Name";
@@ -54,9 +55,9 @@
// TODO: Enable profile correlation when there are multiple objects in a
// dSYM bundle.
if (DsymObjectsOrErr->size() > 1)
- return createStringError(
- std::error_code(),
- "Profile correlation using multiple objects is not yet supported");
+ return make_error<InstrProfError>(
+ instrprof_error::unable_to_correlate_profile,
+ "using multiple objects is not yet supported");
DebugInfoFilename = *DsymObjectsOrErr->begin();
}
auto BufferOrErr =
@@ -84,7 +85,7 @@
return InstrProfCorrelatorImpl<uint32_t>::get(std::move(*CtxOrErr), *Obj);
}
return make_error<InstrProfError>(
- instrprof_error::unable_to_correlate_profile);
+ instrprof_error::unable_to_correlate_profile, "not an object file");
}
namespace llvm {
@@ -120,13 +121,19 @@
return std::make_unique<DwarfInstrProfCorrelator<IntPtrT>>(std::move(DICtx),
std::move(Ctx));
}
- return make_error<InstrProfError>(instrprof_error::unsupported_debug_format);
+ return make_error<InstrProfError>(
+ instrprof_error::unable_to_correlate_profile,
+ "unsupported debug info format (only DWARF is supported)");
}
template <class IntPtrT>
Error InstrProfCorrelatorImpl<IntPtrT>::correlateProfileData() {
assert(Data.empty() && CompressedNames.empty() && Names.empty());
correlateProfileDataImpl();
+ if (Data.empty() || Names.empty())
+ return make_error<InstrProfError>(
+ instrprof_error::unable_to_correlate_profile,
+ "could not find any profile metadata in debug info");
auto Result =
collectPGOFuncNameStrings(Names, /*doCompression=*/true, CompressedNames);
CounterOffsets.clear();
Index: llvm/lib/ProfileData/InstrProf.cpp
===================================================================
--- llvm/lib/ProfileData/InstrProf.cpp
+++ llvm/lib/ProfileData/InstrProf.cpp
@@ -119,9 +119,6 @@
case instrprof_error::unable_to_correlate_profile:
OS << "unable to correlate profile";
break;
- case instrprof_error::unsupported_debug_format:
- OS << "unsupported debug info format (only DWARF is supported)";
- break;
case instrprof_error::invalid_prof:
OS << "invalid profile created. Please file a bug "
"at: " BUG_REPORT_URL
Index: llvm/include/llvm/ProfileData/InstrProf.h
===================================================================
--- llvm/include/llvm/ProfileData/InstrProf.h
+++ llvm/include/llvm/ProfileData/InstrProf.h
@@ -293,7 +293,6 @@
missing_debug_info_for_correlation,
unexpected_debug_info_for_correlation,
unable_to_correlate_profile,
- unsupported_debug_format,
unknown_function,
invalid_prof,
hash_mismatch,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D118166.402967.patch
Type: text/x-patch
Size: 3408 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220126/70fa0f27/attachment-0001.bin>
More information about the llvm-commits
mailing list