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

    <tr>
        <th>Summary</th>
        <td>
            [PGO] Questions regarding PGO usage with LTO, counter overflows
        </td>
    </tr>

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

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

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

<pre>
    Hi, I'm compiling Clang with PGO+LTO. My baseline is compiling profiled compiler without LTO, gathering profiles on our code base, then compiling PGO+LTO Clang.

I'm researching why PGO does not affect lld as much as clang, and some questions arose:
1. May it be meaningful to compile profiled compiler with LTO? In other words, if my final version uses LTO, may profiles become more accurate if they are gathered with LTO compiler?
2. Profiles obtained from LTO compiler generate tons of `counter overflow` warnings in llvm-profdata — can it decrease profile quality since a lot of counters are saturated? I suppose it can because my current LTO profiles produce worse quality PGO+LTO compiler. Can counter size be increased?
3. Are all llvm binaries instrumented when using `LLVM_BUILD_INSTRUMENTED=IR`? Is is possible to check if binary is instrumented?
6. LLVM warned me about insufficient counters until I added `-Xclang -mllvm -Xclang -vp-counters-per-site=256` to `CMAKE_{C,CXX}_FLAGS` — is it normal and expected?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0VF9z4jYQ_zTiZQfGyGDCAw8JhCtTcne9y3XylpGlta1WljitFEo_fWcNgbQzfcGDvfr90-4qItt6xJWYP4j5ZqRy6kJcvVn0aVQHc1r9YoVcw07IRQ869AfrrG9h7ZRv4WhTB18_fRHyYf_8ZQJPJ6gVobMewdKH8kMMjXVoLq8wDkdDTrB__sL4rUodxg-lBMFDyBF0MDigclnq0H-AvVKf9UxEsRHF_fn3rDgioYq64-pjd-ITYAIS-JBANQ3qBM4ZUAR91h0_NUMxmfIGKPQIPzNSssETqBgIRXmhmE7gSZ3AJqgRelTe-rbJDlJ49_k_xgfX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