<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/82901>82901</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Add support for non-LBR profiles to llvm-profgen
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          zamazan4ik
      </td>
    </tr>
</table>

<pre>
    According to the `llvm-profgen`'s [documentation](https://llvm.org/docs/CommandGuide/llvm-profgen.html), this tool does not support non-LBR profiles:

> Path of perf-script trace created by Linux perf tool with script command(the raw perf.data **should be profiled with -b**)

Despite the "should" word, `llvm-profgen` requires input profiles to be created with LBR (`-b` flag) - check the [comment](https://discourse.llvm.org/t/llvm-profgen-with-non-lbr-profiles/77140/3?u=zamazan4ik).

We need to add non-LBR profile support to `llvm-profgen` since LBR functionality is not available on many deployed nowadays hardware/software. As far as I know, LBR support is the following:

* Intel x86-64 - it's called Last Branch Record (LBR). AFAIK, since Nehalem (2008), added support to the Linux kernel - somewhen between 2010-2011.
* AMD x86-64 - it's called BRS (BRanch Sampling). Available since Zen 3 (2020), Linux 5.19 (2022).
* ARM64 - it's called BRBE (Branch Record Buffer Extension): since ARMv9.2-A (2023), Linux 6.7-rc1 (2024).

What about LBR support for other architectures/OS - I don't know.

Using Google AutoFDO is not always possible since this tool has many build issues with the latest LLVM versions.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0Vd2OozgTfRrnpgQCQ3644IJMJqPWl_5mldHuSntn7CJ429isbZrOPP3KkM5PT-9NFMlln1PnnCqYc_KkEUuy3JLlbsEG3xpb_mQd-8l0Ll8WtRHnsuLcWCH1CbwB3yKQVaLUaxf11jQn1GSVELp2QJZbYfjQofbMS6PJckfopvW-dySrCN0Tug_3YmNPhO6F4Y7Q_RfTdUyLb4MUeCl4fzhufacILQj9Ar6VD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