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

    <tr>
        <th>Summary</th>
        <td>
            Diagnostic for functions that are candidates for inlining but couldn't be inlined
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            enhancement
      </td>
    </tr>

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

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

<pre>
    We would like to emit a diagnostic when the function is hot (based on a profile) and a candidate for inlining but couldn't be inlined because its definition is not available externally.

This is a use case we encountered in embedded applications where hot functions are often defined in a source file (rather than a header) and thus cannot be inlined across translation units. Normally this would be addressed by LTO, but that's not viable in this case because embedded applications often rely on complex linker scripts whose semantics is incompatible with LTO ([this talk](https://llvm.org/devmtg/2017-10/slides/LTOLinkerScriptsEdlerVonKoch.pdf) has more details). We would eventually like to address this limitation by extending LTO to support linker scripts, but we believe that such a diagnostics would provide a useful alternative giving developers a hint where it would beneficial to move the definition to a header to allow more inlining.

cc @teresajohnson @david-xl @aeubanks @nickdesaulniers @ilovepi 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyMlEFz4zYPhn8NfcHEI9NybB102P3y-dJM99BMe4ZIyMSaIjUkJCf_vkMpTjadHnqxMZJI4H3wApgzXwJRqw7f1eFpg5O4mNqRJLmY6brpon1r_yK4xclb8HwlkAg0sACCZbyEmIUN3BwFEEfQT8EIxwCcwUUBpU8dZrIQAyCMKfbsSekGMFhAMBgsWxSCPibg4DlwuEA3CZiSMih9FOhofUUWOjI4ZQKWDJZ6DnzPFqIAzsgeO09Ar0IpoPdvW1U9qerb-vviOJePEcolBjPBjYCCiVMQSmSBA9DQkbVkAcfRs8GSIReJiRZNd40ZMBHEXiistazHEXKckiEoUguAhOIogTgsLx2hpXRHIG7KhUKp_heZaFLMGSRhyH4pAKbAkrfwe0xDkQVSpKx96Qj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