[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


================
@@ -1788,8 +1788,11 @@ void SampleProfileReaderItaniumRemapper::applyRemapping(LLVMContext &Ctx) {
 
 std::optional<StringRef>
 SampleProfileReaderItaniumRemapper::lookUpNameInProfile(StringRef Fname) {
-  if (auto Key = Remappings->lookup(Fname))
-    return NameMap.lookup(Key);
+  if (auto Key = Remappings->lookup(Fname)) {
+    StringRef Result = NameMap.lookup(Key);
+    if (!Result.empty())
+      return Result;
----------------
minglotus-6 wrote:

What about adding comments to explain when Remappers returns a valid key but NameMap returns an empty string?

https://github.com/llvm/llvm-project/pull/71479


More information about the llvm-commits mailing list