<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/57929>57929</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Unnecessary mov instruction after ldp - arm64
</td>
</tr>
<tr>
<th>Labels</th>
<td>
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
uncleasm
</td>
</tr>
</table>
<pre>
With a small struct passed as ptr/reference, arm64 code seems to have an unnecessary mov instruction:
```
#include <cstdint>
struct S {
uint8_t *begin;
uint8_t *end;
};
S f(S const &a) { return a; }
f(S const&): // @f(S const&)
ldp x8, x1, [x0]
mov x0, x8
ret
```
AFAIK, this would be identical to `ldp x0,x1,[x0]`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx9U8mO2zAM_Rr5Qkxgy4liH3zITBqg6DEoeixkiY5VyHKgJc38fSkns6HTEoJEmXzkI0X3s37ufpg4goQwSWshRJ9UhLMMATXIAOfoGT94HNCjU8j4E0g_iTWoWSMExClAnGGUFwTpIDmHCkOQ_hmm-QLG3SKa2bF6x8o9K3dMlPd1u_LaOGUThWP1kwpRGxdZ_eVuXfY7rSOw7ePtC5Akcmx-RmB81-PJUIbPjej0q4lt92_6sh9hYLw5UkHEldyFZLzNicBjTN6BJABk3DtQzvAORigCUYXwf6FW0gK2Lv8Gv8bNYvV5Oa9N7vi1yjvbPF5Lttl_9MxdXjzLxbP5aKUSPm367rD7-i0D4mgC_J6T1dAjGI0uGiVtflNyzjSWwAuDVwKiLLCrhKjbSvCKF7qrdVu3sogmWuy-_3sIQA4R_VLew22QiuRtN8Z4DnlAlv6caCJTv1LzRBdrLy_Hw9nPv1BRww4mhISBlM225W0xdtgIFFr1a7mV_XaoeyXbqlGkIBdrrQsre7ShoxqogsJ0vOS8bHldio3YVCsxlGsUVV8NQ4-VlPREOEljVznxavanwncLhz6dAhmtCTG8Gel_MSeH-BJfpjjOvks02CjDVCx8u4XsH6jc_yI">