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

    <tr>
        <th>Summary</th>
        <td>
            llvm-bolt –reg-reassin core dump when the input binary(mysqld) is PGO optimized
        </td>
    </tr>

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

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

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

<pre>
    It's been described [here](https://discourse.llvm.org/t/llvm-bolt-reg-reassin-core-dump-when-the-input-binary-mysqld-is-pgo-optimized/67380) before.

[test.s.txt](https://github.com/llvm/llvm-project/files/10312663/test.s.txt)
[test.fdata.txt](https://github.com/llvm/llvm-project/files/10312664/test.fdata.txt)

Run the following command to reproduce the problem:
```bash
mv test.s.txt test.s
gcc -O0 test.s -Wl,-q -o a.out
./a.out
llvm-bolt ./a.out -o ./a.opt -data=./test.fdata.txt --reg-reassign --print-regreassign -debug-only=regreassign
./a.opt
```
./a.opt will fall into an infinite loop.
![image](https://user-images.githubusercontent.com/28920187/209771991-cd0695f7-102e-465d-9090-3a2c9f7f0de6.png)

![image](https://user-images.githubusercontent.com/28920187/209772272-bad064a6-25e6-4a10-b5cb-cd5c82fb7e91.png)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0lEGP7CYMxz8Nc0FExAlJOOTwttOpenpVLz0TcBIqAnmBvO3201dkZmd2t3up1CdFCGxi_y2bn4rRTh6xJ-KJiPNJ7WkOW-9c8JP16TQE89L_mgi0kQ6InhqMerMDGkrE04wbEnEm0M0prZFUXwhcCFyMjTrsW8TCue9LEbaJwCURuOQjG4JLbMOJbZjTe6bDhszsy8qeZ_QszcisX_fEBuvV9sKWl_jNGWYjW6fAwprsYv9GQ-DStFXHCUg64Bg2LAg_E_7ltoqnhDEVsUh_pc9UTjbN-1DosNyUvQpct_An6qx3tA4jgUvJqxKapsplPGKCfJ9pNCqp_y9b_ZrtEfee8Vh_3z1NM9IxOBeerZ-oDsuivKEp0A3XLZhd43Fl3cLgcMlqrgEafv0GFeeraflOH7XdtlfPpDVlX_nNRtkfjsBP7Btlgaoi7Ol6qyBweXO8t5reHfmH22FNlOWqSHUu_lUmZW_GY_KUsXWz_piZh83gsE8sePdCqvMbzzsxa_pQ7gcvfbbO0VE5R61PgSpPrR-ttwmpC2F9HSgoiXiyi5o-Hfc94sYObyyubc4WHXxCn24dh04CL7s2b7ls21LKkmnDGynGlpUckNWNMExyyVmlQMuxHbnBplj99KHvP0AOQAtsUIY3tWoYCGxYrUrOBqEHpo3QHYxDi7J8J-dk-srISqoT9mXTApRl2cjT3Lei00IILQZR61polEKLTjdCdF1ndHuyPXCAEqDjLW-4LJqm7UquNa87zdEMpOa4KOvuBDnZGHfshWwrfnJqQBcPaAF4fKaHkwBkhmV85dnbp0hq7mxM8REl2eSwfwwn-RlIx4ms3gCJZiDRDCSagXQ8oANI9AokAt0VSZk8NtLffvlK71Q67Zvr__PTP_Tnt3_U908AAAD__1QkvV0">