[llvm] [PseudoProbe] Add PseudoProbeDescUpdatePass (PR #99839)

Haohai Wen via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 21 23:35:50 PDT 2024


HaohaiWen wrote:

> Do you have a small repro for the crash? I'm curious about what the missing function name looks like. For pseudo probe, it tries to use function name from debug info/dwarf to compute the GUID so that the symbol can be matched to the source code function, otherwise it's not meaningful to generate a function profile that compiler can't consume. If this is only a rare case(like the debug info is missing for that function), we can probably just ignore it in llvm-profgen(add some stats/warning), or we may need to fix or maintain the function to use symbol from dwarf.

It's cpu2017/500.perlbench when partialinliner is on.

PartialInliner creates a new function.
There's call inst with pseudo-probe discriminator in this function.
llvm/lib/CodeGen/PseudoProbeInserter.cpp generates a PSEUDO_PROBE MI which GUID was generated by using this new function's name. 
Therefore a pseudo probe record will use this new function's GUID but there's not any corresponding item in .pseudo_probe_desc.
llvm-profgen crashed when calling ProbeDecoder.getFuncDescForGUID.

```
void ProfiledBinary::decodePseudoProbe(const ELFObjectFileBase *Obj) {
......
  // Build TopLevelProbeFrameMap to track size for optimized inlinees when probe
  // is available
  if (TrackFuncContextSize) {
    for (const auto &Child : ProbeDecoder.getDummyInlineRoot().getChildren()) {
      auto *Frame = Child.second.get();
      StringRef FuncName =
          ProbeDecoder.getFuncDescForGUID(Frame->Guid)->FuncName;
      TopLevelProbeFrameMap[FuncName] = Frame;
    }
  }
```



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


More information about the llvm-commits mailing list