[llvm] [Bolt] Add a new hidden option to perf2bolt for testing purpose (PR #163785)

Ádám Kallai via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 7 03:42:00 PST 2025


kaadam wrote:

Thanks for your comment Paschalis.
My basic idea was the following:

1) Users is constructing the proper perf input by 'perf script' manually, based on the aggregation type (brstack) what they want to run.
2) If '--perfscript' set, Bolt will treat -p/-perfdata as textual format (similarly as Bolt does with pre-aggregated format), and process the text file based on the aggregation type. 

> Are there actual limitations to using `--perfscript` with basic samples?

There shouldn't be any limitation, it should depend on the input. However the current implementation covers only BranchEvent aggregation.

> Why not call `parseBranchEvents` or `parseBasicEvents`, depending on `BasicAggregation`? parseBranchEvents would only process the brstack events (ie PerfBranchSample) anyway, right?

Yes, it only process branch events, in all other cases it throws an error.

> (2) The flag is currently a toggle: if set, we treat -p/-perfdata as textual format, right? We could fully align with llvm-profgen if we want and use -ps/-perfscript as a filename instead. Ofc we'll need to adjust the logic, likely in places like [this](https://github.com/llvm/llvm-project/blob/f75973949b0e51eb4b3852c903d08bc72bf5d459/bolt/tools/driver/llvm-bolt.cpp#L255). (not a strong opinion)

Yes, we can use `--perfscript` as filename, I tried to do minimal changes here, that's why I followed the `--pa` logic.

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


More information about the llvm-commits mailing list