[llvm] [SampleProfile] Fix bug where remapper returns empty string and crashing Sample Profile loader (PR #71479)
Mingming Liu via llvm-commits
llvm-commits at lists.llvm.org
Tue Nov 7 22:51:43 PST 2023
================
@@ -1630,7 +1630,7 @@ void SampleProfileLoader::promoteMergeNotInlinedContextSamples(
// separate map so that it does not rehash the original profile.
if (!OutlineFS)
OutlineFS = &OutlineFunctionSamples[
- FunctionSamples::getCanonicalFnName(Callee->getName())];
+ FunctionId(FunctionSamples::getCanonicalFnName(Callee->getName()))];
----------------
minglotus-6 wrote:
pretty much a drive-by comment
It seems to me `SampleContext` could take either a StringRef or a FunctionId in its constructor, and the former asserts names are not empty (https://github.com/llvm/llvm-project/blob/5f295552f1eb9b00efe0d83c5f8e6c9b948cb238/llvm/include/llvm/ProfileData/SampleProf.h#L529) while the latter doesn't (`FunctionId` ctor doesn't require names are not empty either); and this PR wants to fix a crash for the former constructor.
If I understand correctly, is this `FunctionId` needed here and below?
https://github.com/llvm/llvm-project/pull/71479
More information about the llvm-commits
mailing list