<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/64554>64554</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[codesize] Reuse the initialization value for branch
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vfdff
</td>
</tr>
</table>
<pre>
test: https://gcc.godbolt.org/z/c9K5ofqq1
```
void ev_tally(int flag)
{
int a=0, b=1, c=2, d=3;
if (flag)
foo1(a,b,c,d);
else
foo2(a,b,c,d);
}
```
* gcc: Reuse the initialization value
```
ev_tally:
mov w3, 3
mov w2, 2
mov w1, 1
cbz w0, .L2
mov w0, 0
b foo1
.L2:
b foo2
```
* llvm: Initialize for different branches
```
ev_tally: // @ev_tally
cbz w0, .LBB0_2
mov w0, wzr
mov w1, #1 // =0x1
mov w2, #2 // =0x2
mov w3, #3 // =0x3
b foo1
.LBB0_2:
mov w1, #1 // =0x1
mov w2, #2 // =0x2
mov w3, #3 // =0x3
b foo2
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJykVNFu4joQ_ZrJi1XkjAmQhzwAUaSru0_7A5Xt2MErE7exQ7d8_cpOaLcV0NWuhfDAmRnPOR4P9950vVIVFDso6oyP4eCG6qRbrTPh2tcqKB-AbckhhCcPbAvYADadlIvOtcLZsHBDB9icARtZ_l84_fycA62BbmFF50_6eXKmJer0GLi1r4Ab0weiLe8Ay9l_vZsMQiLGgdUUcE8EsDqPhgRWYzRaYDUD9u6uCeBmTkbmf7VzOeCGA-4F4F4C7tt41nuYsl5dbEJiAN4LgHV9ldj8jVtCOimjWN_V6BUJB0VMb4Lh1px5MK4nJ25HdTXJmzBs-1tJhJCjO6X9hUXm7AaYZMEbYBIv_whKcZ7AJPHi263YBNOPoJj3pHBCYvznwsUk6FXFcEusPR2jVv9dFFJEu4G0Rms1qD4QMfBeHpT_Si5yf00NS2BJ32KmMj8rsNvRx7sqvJyHewIDsvztNFbTn_m9uwJk-MH71tFs9mZfU4xpLg1y7Y4mhjcb7G9Z_FFdF3r_ymteV5srayvWlqzkmaryVZkX6xXNy-xQLXElRMnbAvVaL0uaC8aElErwYr3CVmemQoqMbmiZ05yxclFSkSvc8HYt-LpQKrbPkRu7iG0bR15mvB9VtVoWxTKzXCjr0xBF7NULSSAgxpk6VDHmQYydhyW1xgf_niWYYNP0la5V3pwVFPUX4yM9k-lxZONgq0-T2YTDKBbSHQGb9Mam7eFpcD-UDIBNKs4DNqn4XwEAAP__GTCGgg">