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

    <tr>
        <th>Summary</th>
        <td>
            Missed optimization on combining function prologue
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          ljmf00-wekaio
      </td>
    </tr>
</table>

<pre>
    I discovered an interesting result when compiling

```d
extern(C) bool test(bool b1, bool b2)
{
    return b1 == b2;
}
```

and comparing the generated assembly with:
```d
extern(C) bool test(void* b1, void* b2)
{
    return b1 == b2;
}
```
They are supposed to be semantically the same, according to x86_64 semantics and with register/word aligned memory based calling conventions, although, it seems that the compiler can't optimize the function prologue and I assume it is to not possibly mess with the architecture calling convention, but in some cases the compiler can still optimise the code/combine instructions without messing with it. See this comparison with GCC compiler on x86_64 codegen: https://godbolt.org/z/sxnvnv93P .
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJytk01v2zAMhn-NfSEaOHLt2Acf2gQZehgwYLsPks3a6mQp0EfS9NePkt12aHcZMEOJ9UG-fEjRwgzX7gEG6XpzRosDcA1Se5o6L_UI9A7Kw2VCDb2ZT1LRblYcsuJu_a-LZQzLGp_JWWes2WesBWGMAk9atJHmYpux_bItGFmsIrv7ZQL0WPTBarKErDzQiIbl_avh4UPYP1m4HhIktxHdTwgjarTcx7ycw1moK1ykn7Lyn-nPRg4Zu1sTeFv9xxx-THgFbhFcOJ2MI2ZvQNASZ6697Lki-piU4zNGCN73xg4pVQPPTf2zvn0zdhCLEXMlllE6SitjxwvZA1dy1KQ-42zsFQSPoaJ6VOqNPiMJGO1SCOUnE8YpzqUndZwdMXCfQJaGQEveVLOdB3PycpYvmE4fg-6jEJysUWYMmJAe4k2EGaOcdJFcGw-Ur5PxdmZ0bsGOEtz2k_TYUzHxL4iplQLpaHBmjhYO3ScyoE5WamVzuJ4PVMIjmQmpiUU7b0OiXaIbUo0oMV6ikX4D3zE6E_TaY45yS4df9vv3iLS53kUMQg1IzQaT9ycXu44daYxmEEb5jbEjrV7o5571WZ_b8htscuy2dd1s66opqnzoyqEtW5576RV2X6WLt7XWmafymvRlUh4R9lPR82BV9yE8MQexISdaKHV-fd2QzxMVm5YUJiB1wLFq2pLlU8cKMTTttixr1j42vKl3dX2L1bboRcGKXZsrLlC5LqvuM8Y0XiBJ0DyrDrkkf8a26WElqzZsQI497gpst0VT9dltQY0r1SZyxLrktktIIoyODhV1sHs_pBaKPYwpHOnzQFdGHk_zY1HcXPAXlyZPAF1K4Dcg_Zby">