llvm-project
7bb10818 - [llvm-profgen] Ignore comment lines in unsymbolized profiles (#248812)

Commit
6 hours ago
[llvm-profgen] Ignore comment lines in unsymbolized profiles (#248812) Android's `simpleperf inject --output profgen` emits trailing `// build_id:` and `// <binary_path>` metadata comments matching AutoFDO's `create_llvm_prof` text format. Unlike `create_llvm_prof`, `llvm-profgen`'s `UnsymbolizedProfileReader` reads until EOF to support multiple context blocks and previously rejected `//` comment lines. Skip full-line `//` comments (with optional leading whitespace) inside `UnsymbolizedProfileReader` while advancing `TraceStream`'s line number so error diagnostics preserve accurate 1-based line numbers. Also handle empty or comment-only inputs cleanly by initializing an empty sample counter entry (matching `PerfScriptReader` and `ETMReader`), and reject unexpected trailing content or extra counter blocks in non-CS profiles as well as unheadered blocks in CS profiles so unsplit multi-binary profiles fail with a diagnostic rather than silently merging unrelated addresses. Assisted-by: Antigravity
Author
Parents
Loading