<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/65043>65043</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Same phi is calculated twice and not optimized away
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
komalon1
</td>
</tr>
</table>
<pre>
look at reproducer at https://godbolt.org/z/575on875q.
` short tmp = 0;
short tmp2 = 0;
#pragma clang loop vectorize(disable)
#pragma nounroll
for(int x=0; x<width; x++) {
tmp += in1[x];
tmp2 += in1[x];
}`
even though `tmp` and `tmp2` compute the same values, in the resulting IR there are 2 phi instructions calculating the exact same value.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8Ut1u4ywQfZrxzaiRA8Y_F75oGln6br99AgwTmy0GL-Ck7dOvcCK1u6pWsmQOh5k5Z3RkjGZyRD2IE4hzIbc0-9C_-kVa747F6PV7b71_RZkw0Bq83hSFjOaU1gj8GdgAbJi8Hr1NBx8mYMMHsEE0wru2Eb8OUJ6hfIa6RMQ4-5AwLSsCP2MJ_HRn8SvHviGB8TXIaZGorHQTWu9XvJJKPpgPAtZqE-VoCVj3XZHzmwve2gd38QFYa1zCN-DnPCkfXm5Gp_kO2Gn_OoTmiwq8S2enLNC4I4jTG4jzH0rxYeGfj6A5Q13eMV3JYZr9Ns0IdZmWNe9KOv1ALEPll3VLhGkmjHIhvEq7UQT2gsbtt4HiZpNxE_73f74IhDIQMlxng8bFFDaVjHcRlbRqs3J_myvpTar0peuh0D3XHe9kQf2x7jjjvBGimHs9Ci1l05S6FuLYKdGRulA7ym4cL5p4YXpWMl62rD1WFePiINtLfZRjpavuKLkSUJW0SGMP1l6XHJfCxLhRX4uy4oWVI9m4p5ExRzfcSWAshzP0ueZp3KYIVWlNTPGzSzLJUv8je9j9frokjelmFO0bdT6hX5NZzAdplDf5XmzB9n-F2aR5Gw_KL8CGPOHxe1qD_0kqARt2XRHYsOv-HQAA__-M9wIR">