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

    <tr>
        <th>Summary</th>
        <td>
            coroutine allocation optimization
        </td>
    </tr>

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

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

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

<pre>
    I was writing recursive generator and wanted to make a static 'empty generator'.
Because i cannot create promise by myself i create a lambda and static 'generator' which is always empty.

Unfortunately clang is not able to optimize generator allocation in such a trivial case, while 'static' means that compiler must be 100% sure its memory never dies

Example with task(co_await adds 'new' call, because compiler thinks memory for frame required):
https://godbolt.org/z/G9Mqa4zbj

So i propose to not allocate frame (through new) for static coroutines

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxck89yozgQh59GXLriAmFsc-Cw2ay39rCnqTlPNaINHesPkRozztNPgZ3EMxcoFY2-r39qYUrce6JGVc-qeslwkiHE5ky2DT5rQ3dt_oMZE8yRhX0PkcwUE18IevIUUUIE9B3M6IU6kAAOzwQISVDYgNJ7cqNcv8qV3m9U_qLyv57J4JQIGAx6HwRMJBSCMQbHiaC9grsmsqel4vYJwaJrO1yZX4jHzWEe2AzACdDOeE2w8u_I2_O7P4Uok0chewVj0fdL_aKAraWlizAKO37_rU1rg0Hh4IE9pMkMgCCRL4wWDCZS-u8FbmlRusktPo7QJ5ABBUxwI1uK4KYk0BIUea50BWmKBCwJHLkQr-DpQhE6pvSo_c9PdKMlmFkGEExnpQ8m_MAZWQC7Li1cT_MCNWjt4tPeM_4ky8D-_Ak6hQiniI4g0tvEkTqla1XegYPImJaVPip97EPXBiubEHulj-9KH_-t_3_D7Xv7-mj5LQAvRziGtCa5pnqLju4spQ8yxDD1A6y69epxP04TYpiE_UfvWdeUXV3WmFFT7Oq82hb1bpsNDelTWZhcV1VNRVtjva2LA1Yd7jtT7fCQcaNzXeZ7fSjyqtZ6s9_rU7fP60pXVV6Wpdrm5JDtxtqLW_rKOKWJmt22qMvMYks2fdyM2CxFT-3UJ7XNLSdJX78Ji6Xm0_xxVO6DtC6yKdrmj1BZhqndmOCUPi773V9PYwyvZETp4-qUlD6uWr8CAAD__-jDPYA">