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

    <tr>
        <th>Summary</th>
        <td>
            Miscompile after changes to MachineCopyPropagation in commit cae46f6210293ba4d3568eb2
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
      </td>
    </tr>

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

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

<pre>
    We started to see miscompiles downstream after the update to MachineCopyPropagation here: https://github.com/llvm/llvm-project/commit/cae46f6210293ba4d3568eb21b935d438934290d

I managed to reduce one failure and convert it into this (just picking AMDGCPU as target to get something with register tuples):

```
# RUN: llc -mtriple=amdgcn-- -mcpu=gfx900 -run-pass machine-cp -o - %s

---
name:            test1
body:             |
  bb.0:
 liveins: $sgpr4_sgpr5, $sgpr6_sgpr7

    $sgpr2_sgpr3 = COPY $sgpr6_sgpr7
    $sgpr0 = COPY $sgpr3
    S_NOP 0, implicit-def $sgpr0
    $sgpr3 = COPY killed $sgpr5
    $sgpr2_sgpr3 = COPY $sgpr6_sgpr7
    S_NOP 0, implicit $sgpr2_sgpr3
...
```

Without the changes to MCP:
```
> llc -mtriple=amdgcn-- -mcpu=gfx900 -o - -run-pass machine-cp mcp.mir

 $sgpr2_sgpr3 = COPY $sgpr6_sgpr7
    S_NOP 0, implicit-def $sgpr0
 $sgpr2_sgpr3 = COPY $sgpr6_sgpr7
    S_NOP 0, implicit $sgpr2_sgpr3
```
After cae46f6210293ba4d3568e:
```
> llc -mtriple=amdgcn-- -mcpu=gfx900 -o - -run-pass machine-cp mcp.mir

 $sgpr2_sgpr3 = COPY $sgpr6_sgpr7
    S_NOP 0, implicit-def $sgpr0
 $sgpr3 = COPY killed $sgpr5
    S_NOP 0, implicit $sgpr2_sgpr3
```

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzcVc2O2zYQfhrqMpBAkZJlHXRw7broYROjRRD0FFDkSOKGFAWS2jRvX0jK7rqOC6RBe4lhkBTnhzPfDPmJEHQ_Ijak_ImUp0TMcXC-aR_dhEnr1OfmPUKIwkdUEB0ERLA6SGcnbTCAcp_GED0KC6KL6CEOCPOkRMRF_UHIQY94dNPni3eT6EXUboQBPRJ-gCHGKRB-IOxM2LnXcZjbTDpL2NmYp-cpnbx7RBkJO0tnrV4XAotdt2M5ZTVvRaF4udtjy_K25qUq-L7mBaupIvRE6GEbfwUrRtFviXhUs0RwI0IntJk9ghgVSDc-oY-gI-gxOoiDDkDY_nEOESYtP-qxh8PD6Zfj5R2IAFH4HuPicJmCsxiHReWTjgN47HVYQZkng4Gwesn1KiKyo1_-2yfj8Nu7NwsyxkhIbfR6Mkj4SVjVyzFNIbVymgk_9d2fNaWQ-nlMJxEC2A3pVE6QOkiBsDJcH5Wm6bYYhV2xv_pFDDHfpEvJb6RAquMmBGjbjL7kAEY_oR6XAgJhRegnX3xYxpKw4_PObt2prkNZfW5Stko5EH6C49vLH3etrvTpV5r8Vef3D2_eXoAuh2s7GS11TBV2L7Zfebs696M2BtWzoPz-QO8EceNj082y7H4PrON7HQc3x_U2yUGMPYb1Oh0vrx10Y8d__uamWfrjbudYOWVW-78V6z8A4F4V_i9cb2A5rI_S_dfiB4PyW7r5O1FMVMNVzWuRYJNXNKd1XuRFMjSsVWXVMlG0WFUKKeWdlGpfq6LN27xjiW4YZTzPWZVzxnmR7dmOdsjpXirVsbokBUUrtMmWlz5zvk90CDM2FS9zlhjRognP5OSblQ7auQ-koEaHGF7Noo4Gm4cXbvrCR9e35z4Z6RE2WvmHNmlZMnvT_GuuWvMIhJ3XVP4KAAD__4QuM1Q">