<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=http://email.email.llvm.org/c/eJylVNty2yAQ_Rr0wlgjliApD3pI7KTTmWTamWSaZwTEpsXCFci5fH1XkhPnYtdpwyAuy-45h10NtdcPFcmzENtORXoFJJuR7IQUp-OCYgsL30YqGeHvjfBsJMVsux5Gcx9N21C1kC29f3MWzXLlZDSET-PDyjRyaeg14Wd07a2mtwTKa0ogjwSO6SsxMZWMEj57gbgxw2jGsFPKXsnawbvluYKeCHm2IXn2MmQcLy5-XNLJt965_DKdUhnonXGuj3vpi6FjH7YbEj7FvPKzgeyJa1C9uxHglBxl-4Ofb923pV-H2lHMB5QERGtXvQtMEUYYef_O-W6kEHg0OA1B2n4O1zbKbXAPc8J-0tbE3zszOY5fMfFYg__M-O777b3h_gJt68RYymD3dfck-SDqE67YnWH6UXWv4CBl-UGZ8G86R1zxroAfV_YGjKfsL7Ufx0WMq9DXEs6xz5VK517X3sXUt3O0POInRKFuSv-9TXTF9TE_lonsIr5XlZZr23uvZRN-PSRd66o3gDYuujpVfokb59ZP02TV-p9G4XN0bkPoTOhpeFHyZFEVoIvcHDGlOee3XGmcQeQiZ5DXoOvEydq4UBFxSgAGUH7iV9Eu7aOM1jcIBkTMks-LsRVkgJ2xvjZHWVoWwohaMZWpsmQ6x2fFLKV1aY_TpyxpqwGy7uYBD50NMWwPZQh23hgzaEeF0UZnqktkNRpLjf-QdNTf4lJ3jZZNxNXEealDMiirBll_AMI0mYk>53783</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Missed removal of redundant re-loads
</td>
</tr>
<tr>
<th>Labels</th>
<td>
llvm:optimizations
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
davidbolvansky
</td>
</tr>
</table>
<pre>
`struct S2
{
short a1;
short a2;
};
extern char x;
template<typename T> void f(T &t) {
t.a1 = x;
t.a2 = x + 1;
}
template void f(S2 &);
`
LLVM -O2 (GCC as well)
```
void f<S2>(S2&): # @void f<S2>(S2&)
movsbl x(%rip), %eax
movw %ax, (%rdi)
movsbl x(%rip), %eax
incl %eax
movw %ax, 2(%rdi)
retq
```
ICC -O2
```
void f<S2>(S2&):
movsbl x(%rip), %eax #11.12
movw %ax, (%rdi) #11.5
incl %eax #12.16
movw %ax, 2(%rdi) #12.5
ret #13.1
```
https://gcc.godbolt.org/z/557cW8oPr
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJylVN9v2yAQ_mvwC4plIMTOgx-apJ0mtdqkVtszBpKwEZMZnCb963e2k-b30m0IYzjuvu_uO4nCqU2OBokPVS0DfqYomaDkDqWjboNh-LmrAhYEsXMjfTeidLLft6teB12VWM5Fhdcnd0EvllYEjdg4bJa6FAuNXxC7xytnFJ4imr1gRAcB0SE-SibEgmDEJgeIWzPtzBA2wuQorQu8e55n2hABzz5kkByGdOvj47cn3PvSOGefxmMsPH7V1jZxh74Q2s32uCVhY9CV3bdkO64268sDUYZRP7ke_F51MxZu5QuLQQ-aIcors2xc6BhguBbrM-fXjoLDVevUBinzf7imlHaLe5uTXietdPh1Uclu_QzCQw_-UfHL9V2t8HqD9n0iJCb0crlXRL6JusPllxXGH83uCI7GZHAzTfp3eXa4_KyBH8_sBIzF5A-979Z5CEvf9JI-wJxJGc-cKpwNsatmYHmDj_NUfs_c1ypSOVNDNhRRMMHq_Ml4rxXkCMULi90UtqoulSgD7HrWCeWjurL5CYsJ87qIpVvAwdrV7tdbVu6HlvBGPQBwrX3DzdKMRfOcJppMM1IMpopPU8Z1PyVTRTih_b5MmYysKLT1OeIjRGkLyu7cMpiFeRPBuBLAKOKTyAAUhUlII3c_ibOUa15IIhOZZUQN4KXQC2Fs3IA0KkRV3mZX1DMPl9b44PeXwnszK7VumQFf1AFe8lyJlWl0XInS_9xEbT15W8xvrE6EFg">