[CSSPGO][llvm-profgen] Virtual unwinding with pseudo probe

Authored by wlei on Nov 25 2020, 8:33 PM.


[CSSPGO][llvm-profgen] Virtual unwinding with pseudo probe

This change extends virtual unwinder to support pseudo probe in llvm-profgen. Please refer https://groups.google.com/g/llvm-dev/c/1p1rdYbL93s and https://reviews.llvm.org/D89707 for more context about CSSPGO and llvm-profgen.


  • Added ProbeBasedCtxKey derived from ContextKey for sample counter aggregation. As we need string splitting to infer the profile for callee function, string based context introduces more string handling overhead, here we just use probe pointer based context.
  • For linear unwinding, as inline context is encoded in each pseudo probe, we don't need to go through each instruction to extract range sharing same inliner. So just record the range for the context.
  • For probe based context, we should ignore the top frame probe since it will be extracted from the address range. we defer the extraction in ProfileGeneration.
  • Added PseudoProbeProfileGenerator for pseudo probe based profile generation.
  • Some helper function to get pseduo probe info(call probe, inline context) from profiled binary.
  • Added regression test for unwinder's output

The pseudo probe based profile generation will be in the upcoming patch.

Test Plan:

ninja & ninja check-llvm

Differential Revision: https://reviews.llvm.org/D92896