[llvm-branch-commits] [llvm-profgen] Support [buildid:]0xaddr format in perfscript input (PR #190863)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Tue Apr 7 15:27:10 PDT 2026


https://github.com/aaupov created https://github.com/llvm/llvm-project/pull/190863

Add support for optional build ID prefix in perfscript addresses,
following the format buildid:0xhexaddr. This enables multi-DSO profiling
with a single input file: each address optionally carries a build ID,
and profgen filters addresses by matching the binary's build ID.

Parsing changes:
- parseAddressWithBuildID: parses [buildid:]0xhexaddr, handles 0x prefix
- extractLBRStack: handles buildid:0xaddr/buildid:0xaddr LBR entries
- extractCallstack: handles buildid:0xaddr callstack frames
- looksLikeLBRLine: replaces starts_with(" 0x") for LBR line detection
  to support buildid-prefixed lines
- isLBRSample: also accepts buildid:0xaddr/ pattern
- checkPerfScriptType: strips buildid prefix and 0x for format detection

Filtering: only addresses with a non-empty buildid prefix that doesn't
match the binary's FilterBuildID are marked as external. Addresses
without a prefix use existing addressIsCode check (backward compatible).

--filter-build-id=<hex> CLI option overrides auto-detected build ID.





More information about the llvm-branch-commits mailing list