[llvm-branch-commits] [BOLT] Allow empty buildid in pre-aggregated profile addresses (PR #190675)

Amir Ayupov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Mon Apr 6 13:36:15 PDT 2026


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

Allow `parseString()` to return an empty `StringRef` when the delimiter
appears at position 0. This enables parsing pre-aggregated profile
addresses with an omitted buildid but preserved colon (`:addr` format),
where the empty buildid corresponds to the main binary.

Previously, `parseString()` rejected zero-length fields by treating
`StringEnd == 0` the same as `StringRef::npos` (delimiter not found).
These are distinct situations: `npos` means no delimiter exists, while
`0` means the field before the delimiter is empty. The fix removes the
`StringEnd == 0` sub-condition so only the missing-delimiter case errors.

The existing test for buildid-prefixed addresses is extended to also
verify that `:addr` input produces identical output to the plain-address
and non-empty-buildid variants.

Test Plan:
Added empty-buildid input file and extended
`pre-aggregated-perf-buildid.test` to run perf2bolt with `:addr` format
and diff the fdata output against the existing buildid-prefixed result.





More information about the llvm-branch-commits mailing list