[llvm] [llvm-profgen] Loading binary functions from .symtab when DWARF info is incomplete (PR #163654)

Lei Wang via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 21 15:24:09 PST 2025


================
@@ -1034,6 +1140,48 @@ void ProfiledBinary::computeInlinedContextSizeForFunc(
   }
 }
 
+void ProfiledBinary::loadSymbolsFromPseudoProbe() {
+  if (!UsePseudoProbes)
+    return;
+
+  const AddressProbesMap &Address2ProbesMap = getAddress2ProbesMap();
+  for (auto &[Addr, Range] : StartAddrToFuncRangeMap) {
+    auto Func = Range.Func;
+    if (!Range.IsFuncEntry || Func->NameStatus != DwarfNameStatus::Mismatch)
+      continue;
+#ifndef NDEBUG
+    if (PseudoProbeNames.count(Func))
+      continue;
+#endif
+    const auto &Probe = Address2ProbesMap.find(Addr).begin();
----------------
wlei-llvm wrote:

Should we search in the function range(using the end address as the safeguard ) instead of the whole map

I found this from BOLT matching: https://github.com/llvm/llvm-project/pull/100446/files#diff-9c8ed910a52bb3d6726fd342b03b8fd3c77c651a9459531a439bbea725b44279R644-R651

I think we can use the same look-up 
```
auto Probes = Decoder->getAddress2ProbesMap().find(Addr, Addr + Size);
... 
```
Otherwise if it returns something that's not in the current function range, we get a wrong function. 


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


More information about the llvm-commits mailing list