<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/105578>105578</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang seemingly ignores `noinline` attribute
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
pkasting
</td>
</tr>
</table>
<pre>
Clang seems to ignore `[[gnu::noinline]]` (and equivalent spellings) in at least some cases where gcc respects it. For example, when compiling the following code with `-O1`, Clang optimizes away the call to `F0()` in `F()`, while gcc does not:
```
[[gnu::noinline]] int F0() { return 0; }
int F1() { return 1; }
int F() {
return F0() + F1();
}
```
Live example: https://godbolt.org/z/TaK5Gh485 (see generated assembly)
Curiously, with `-Os` both compilers inline the call. This seems like a bug to me also, but maybe I'm mistaken.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U12vmzAM_TXhxbpVMFDoAw_9ENO0SXu5fyCAC9kNCcOhXe-vn1J6295NmoSEYh0fH_vYill3lqgU2U5kh0jNvndTOb4p9tp2Ue3aS7k3ynbARAODd6A76yYCsZbXpF1nZ5FsRbK1TlujLYnsEL61BIGFsi3Qr1mflCHrgUcyRtuOBW5AW1AeDCn2wG4gaBQTw7mniaBrGpiIR2o8g_YrqNwE9FsNoyGB-4Cy0Lhh1IEPfE9wdMa4c3g1riU4a98HmS8_4iAW97B04kavB_1ODOqsLtfMRhkTehNrWUmBhcBN0K_tNXIPLHW1WdS1jhis86F7eRByGxDLtzz_Nx7Q1sNHLRD5Diby82RBimQHIj8sHFdU_C8q_oR6wj6gSxA-Mh61cHenFMkN9qD63MN3faL71JMt9N6PHPrBSmDVubZ2xq_c1Ams3gVWr-pb9qVPiyx4z0TQkaVJeWpBMdNQm0so-6R6P0_azRzi-yfLOMy_dr6_eUwTwzK_u2EreO013xbT6DcCBfXcBR8HAmXYBcp69jCoS03wVWA-wKDZqzeyq6gtk3aTbFREZZxjinlcJBj1JcbrND-2qWpVioVss816I4_r4zGTcZxs8kiXKDGVBcYoMclwVdTHPM0kYUFFQ6hEKmlQ2qyMOQ1hOpFmnqmMZZblRWRUTYavN4fYhJ0UiOH8pjIkvNRzxyKVRrPnB4XX3tDTMWrbmcvtGjkM7b5gawnK-0nXs6donkz5l2va93O9atwgsAr0t9_LOLmf1HiB1VUuC6xuik8l_gkAAP__fcFEVA">