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

    <tr>
        <th>Summary</th>
        <td>
            Missing decorations for builtin library functions
        </td>
    </tr>

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

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

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

<pre>
    The library function `cos` redirects to `__builtin_cos`. It, and many others, could be treated as `__attribute__((const))` but aren't. Optimizations are missed as a result.

toy example:

```c
void whateva();
void pureFunc(double d) __attribute__((pure));

void fun(double d) {
    pureFunc(d);      // call eliminated in EarlyCSEPass
    __builtin_cos(d); // call never eliminated

 whateva();
}
```

https://godbolt.org/z/KP88hnxoP

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx0k9tuozwUhZ_G3GwVOYYYuOCiJ6Rfv0at1LmPfNgJnjF25EOm6dOPCKlKOzPIArG9_Hl5wRYxmoND7Mn2jmwfCpHT6EP_tMefL6Ox3hXS63P_fUSwRgYRzrDPTiXjHRBOlY-EUwioTUCVIiQ_l3c7mY1Nxu0WQQn_JcLuQTgNk3Bn8GnEEOeS8tlqkAgpoEioQcSFIFIKRuaEux1hLWGt8i4mwrp5cAoyJxABHWFNKuHpmMxk3sRsLM51mEyMC05AwJhtKgl9IPR2uSd_BnwV09EiqW7XM4TTZajl_eSNhl-jSHgSFycdqe5WU8cccMhOEdZqn6VF0IR18JcTzMrrAd4JK84-uy8I0lxVAPBpm4UAl4uwgbABlLAW0JrJuEuMxsGjCPZ8__L4LGL84Hz-Nh-wNcfhCcOKtvb6jyhI8_AlvvWiMaVjnHO-bHLwWnqbSh8OhA1vhA3_P7ft6F798yIvdF_prupEgf2GdzVnVc15MfZ73QlOG71pKUfFGq72mtMt41tRNxJ1YXpGWUW7TbXhdc142dKOb9VGyo1qui3jpKY4CWNLa0_T7KAwMWbsOWcVL6yQaON7M4R-Ft3IfIikptbEFD-WJZMs9t9MjMYdQKPy4fr37X2Aa8Z_NE0scrD9lzhMGrMslZ8IG2b-9XFzDP4HqkTYcPEYCRsuNn8HAAD___x3I1g">