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

    <tr>
        <th>Summary</th>
        <td>
            [arm64ec] Exit thunks are not generated for libcall functions
        </td>
    </tr>

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

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

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

<pre>
    Compiling e.g.
```
#include <string.h>
extern void *b;
extern void *a;
int test() {
 memcpy(a, b, 0x10000);
}
```
will result in a call to the llvm.memcpy intrinsic that is then lowered to an actual memcpy call as part of ISel after AArch64Arm64ECCallLowering has ran, resulting in no exit thunk being emitted. This is similarly the case for all other libcalls and for many of them it's not possible to determine if they will be used at the time the EC call lowering runs. Emitting exit thunks for all possible libcalls would work but is obviously not ideal

CC: @cjacek  @efriedma-quic 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxsk9GO6ygMhp-G3lgTEZKm04tc9HRaaaW9230BhziNzxDogjOdvv0K2u2eiyNVlGCwv_8HY0p88US92v5Q248NrjKH2A93h7e0GcJ4749hubJjfwGqLpXSH0ofVKefv8enadhbt44Eqjkmiewv1aya0yNM30LRw1fgEZQ5DKr58dsAvgLsBYSSKPOuzB7U7rkOCy32elfmHZU5wpAH_V1rrbUy-9dxtfv4LeeNnYNIaXUC7AHBonMgAWQmcO5rqR75gX3WkNiCzCjAKe_w4MKNIo35BHpAKyu6J9IjFSa4YhQIE_zxFznASSjC4RDt3LWHuHTt6XhE5_7MibKlMyaI6LOOB1deZA8-AH2zgMyr_4SBiv0Li9BYwd8zp8yUeGGH0d0Lv8VEMIUIGSTITBEcDxkrAfqxhBb09wwnMy3AoswugQ8C15ASD46yspGE4sKegMvGOxTbBoI10QgopZrwQmVyOj6ku_8kxdWnCk4ZtlC_ZKQX3avcC_AWVjfCLcRPGNZieBi-OKzJ3Qsgj4TueadlPB5VcwDVavsTLX1CntIUmcYF3_5Z2cJm7Jtx3-xxQ329M6Ztjdb7zdwbnOzQve-ptdQimS129W7Xte_Y4badpg33RptW75q67nTX7qthwrHrutrWZmj2usu1FmRXlTcT4mXDKa3U17puttuNw4FcKi1ljKcblKgyJndY7POht2G9JNVqx0nS_2mExZVexPxWyKrtB5x-MRAjFTsu5Cmi0ONWny7CtHorHHzarNH1s8g1qeagzFmZ84VlXofKhkWZc673_Hu7xvCTrChzLpRJmfNTxldv_g0AAP__8LNYIQ">