<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/135377>135377</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] await_suspend() -> std::noop_coroutine() = missed optimization
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
tzcnt
</td>
</tr>
</table>
<pre>
When returning `std::noop_coroutine()` from `await_suspend`, this always seems to result in:
```
lea std::__n4861::coroutine_handle<std::__n4861::noop_coroutine_promise,%rcx
jmp *(%rcx)
```
This delegates to a function that is simply `ret` (<std::__n4861::coroutine_handle<std::__n4861::noop_coroutine_promise>::__frame::__dummy_resume_destroy()>)
This seems like a missed optimization. Can we simply inline the `ret` and skip the indirect jump?
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJykk89upDgQxp_GXEppgYEGDhzYTvoJVtojKnA1OPEfZBfJdp5-Bd3JTkaZuYyEhGx9Vf5-n8sYo54cUSvKv0T5mODKsw8tv4-Ok8Gra_vPTA4C8RqcdhOIYxpZibwTeee8X_rRB7-ydiRkLWQjjilcgrebEN9Qcx_XuJBT4pgKeQKedQQ0b3iNEIlsBPYQKK6GQbutb9pt0tuXdoYQPg_se1fUx-y2-Dy4n9EpQyI_fS_8arNfgrc6kpAnIcsw_ivS7tkuIGS3E-xbsvnJhki7vzfnigxNyLTbRrisbmTtHfCMDDpC1HYx1w0-EG9ZbD1_ZexPCfKnD-0loKWPhVqtvfZbppZ6RZGDv94vJ3-6o91xbjdg9AsBgtUxkgK_sLb6HTeuA5zQwRt9cGlntCPgmX5ARKcgvuhl39ZO6UAjw_NqF5GfE9XmqskbTKjNqqLI6-xYV8nc1kpmdBlQDtlYDOkFL0VTYY04UNPIbEx0K1NZpkWWZYWs0-owKqqacqQKizGry0EUKVnU5mDMqz34MCU6xpXaLC_zqkoMDmTiPthSjgbdJKTcZjy0W8HDsE5RFKnRkeP_LViz2V_DraJ8hK9TvOcIDyJ_gt--AxD543eJJmsw7cy8xK1WnoU8T5rndTiM3gp53ozcfw9L8M80spDnHSwKeb6zvbbyvwAAAP__2PQwGg">