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

    <tr>
        <th>Summary</th>
        <td>
            inconsistent copy propagation for aggregates across calls with local alloc
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          pinskia
      </td>
    </tr>
</table>

<pre>
    Take:
```
struct f {
    int a[1024];
};

void g();
struct f hh();

struct f h(float *fp) {
 struct f a;
    a = hh();
    struct f b = a;
    g();
    *fp = 1;
 a = b;
    return a;
}

struct f h1(float *fp) {
    struct f a = hh();
    struct f b = a;
    g();
    *fp = 1;
    a = b;
    return a;
}
```

These 2 functions should produce the exact same code generation. The only difference between then is where the assignment to a happens; on the decl initializer or outside of it.
h produces better code generation than h1; h1 has 2 calls to memcpy while h has 0.
https://godbolt.org/z/GfMq96rTY for reference.
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJy0U02vqzYQ_TVmM3qRMRBgwYLoKl11l02Xgxmw-xyb2uamub--Mvm4aaSqqychYc2cOXPmjI0h6NkSdaw6sOojwzUq57tF2_BTYza48dqd8Cexome8Z3t-_3gfol9lhAlYfWC8BwDQNgKy6pBzUbLqgxUpwerHgfefTo8wM9Ew0d6CTxalXsP_yjDRTMZhBCb6aWGifbR8QvBWlTQgsOLjjS3Fn9hhA7xUzO_Qrc2Gyu_BG-nwDfEUV28fLGnEN835f4p-1fJLxD5N-D-9L8tkvD8pCgQCptXKqJ0NEJRbzQiLd-MqCaIioL9RRgh4JpBuJJjJkscE38FJEThrrjDqaSJPVhIMFC9ENtVa0AEuivyN6XbxzmQjRAcICpeFbGDFAdyGh5GkAW111Gj0F3lwHtwagx4J3AQ67hjv1UNeSL0i-XddEBXatI_iACoHhQEESDQmpL5nOsvlChelDYHasnyjjXEJ6c6LIxPH2Y2DM3Hn_MzE8YuJ42_T73-1e3_6AybnwdN93l02dsXYFi1m1OV12fCKNwXPVId1ux_Kac_zZt_UsirappaI5VQKbOtaZLoTXFS8EiXPS17wXTHRQGUum6bc82ksWMnpjNrsjPk8JymZDmGlLi_zgreZwYFM2J6xEJYusGWZEOlV-y4V_RjWObCSGx1i-KaJOhrqtJXOBh1i2oh0yzUZu-B8MzFNifPsacZIAVB6F8LdxouOCoyTaACNcTJbveneDNRRrcNOujMTx9T4_vuxePcnycjEcZMbmDje5_nsxD8BAAD__93_YoQ">