<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/76633>76633</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang] `[[noreturn]]` can result in worse code gen
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
philnik777
</td>
</tr>
</table>
<pre>
```c++
NORETURN void my_abort();
void call_abort() {
my_abort();
}
```
When `-DNORETURN=`, this results in
```
call_abort(): # @call_abort()
jmp my_abort()@PLT # TAILCALL
```
When `-DNORETURN=[[noreturn]]`, this results in
```
call_abort(): # @call_abort()
push rax
call my_abort()@PLT
```
([godbolt](https://godbolt.org/z/xfo5zWfM4)), which seems strictly worse than the above version. While this isn't significant performance-wise, a very similar pattern can be observed in libc++ for `__throw_` functions, which results in quite a bit of unnecessary code due to multiple layers of this.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVF9v-yYU_TT45SoRAf-JH_yQNIs0KeumqlMfI4yvYzoMHuCk6aefsFN169JJ0w9dGVucC-eci6_wXp0MYkWyLcl2iRhDZ101dEob9UdRFEltm2tFcjqHJGwbg-4I3Tz--vTT8-9Pj3C2qoH-ehS1dYGwNWEl4TfQ_JwQUmj9dwyQ4gb6NrnY3V4-CMyfLx0aIDld7D44EL6Lq-wBQqc8OPSjDh6UuZv_lQnhG_hmEMaBpPRfGTPv136YUF_4p_S3w_O9nZ43Px8eNofD_1AVC7M11mEYnSHZLsaPKf1vSbcxjL6LsxNv_1yIaXf13j0_ArLtyTa11SFSZ-suhMETviFsT9j-trS07kTY_p2w_Vtrs_eX9pc07hzjAS6dkh14xN6DD07JoK9wsc4jhE4YCB2CqO0Z4YzOK2uW8NIpjbNFyhvCigDxqqtWSWECDOha63phJC4uymM8RcTsK3jVKy0cDCIEdAakMFAj2NqjO2MDyoBW9e1PgNa6WLPjMXTOXo4kp9CORgZljf-k_lkl-HNUAUFArQLYFkZjUKL3wl1B2gahGRGChX7UQQ0aQYsrOh-hUcwyaSrelLwUCVargvIyXxesTLqKlryp6VqmHNu2oGmGOV3lZSZK2siiwURVjDK-Ypwyytdpucxk1qRSNBRXabFucpJS7IXSS63PfSxIorwfsSrynPNEixq1nxoFY1ILcyKMxZ7hqohf1OPJk5Rq5YP_3CGooKfuMmdku2jWN3d6cnp2Kho113fy5IQmGZ2uvlwdFbqxXkrbE7aPJ96mxeDsK8pA2H4S4AnbTxr-CgAA___4u3Q4">