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

    <tr>
        <th>Summary</th>
        <td>
            [X86] GlobalIsel removed type info when legalizing ICMP, causing out of bound access on debug build
        </td>
    </tr>

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

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

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

<pre>
    ## Reproduction 

[Out of bound on debug build](https://godbolt.org/z/zTPP5jbTG) 
[Unable to legalize on release build](https://godbolt.org/z/hrnsaofYY)

The bug can be reproduced on LLVM 16, 17, and upstream.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkU1r3DAQhn-NfBmyyOPvgw9JFodAQkPZluYoWWNbQSsZfSQkv77YbNuQWw8aIcS8zDOPCEHPlqhn1Q2rjplIcXG-P4oobp33aY2kMunUe8-wYFjAd1q9U2mM2llg_Mj49aVWN99SBDeBdMkqcBYUyTSDTNooVh0ZtkuMa2DFNcOB4TA7JZ2JB-dnhsPHdk5PT9WLPN0x7OBv7A8rpCGIDgzNwugP2sI9GRKB_id-8TYINz0_M-w-j35atpgZRmFBEvgLIu0QDw8_HyGvGd5C3mxVWAVpDdGTOB8y1ReqKzqRUZ83ec6rpmx4tvQci6mqx6ol6sqmlXUnaFJlPWLX1OMoMt0jx5IXmGNelgU_qIm3reBUVoVqBa9YyekstDkY83reKDIdQqK-rZEXmRGSTNi1IVp6g_2TIW4Wfb_1XMk0B1Zyo0MM_1Kijmb3_autWXWEO-OkMPeBDHg6u1dSEN9XAm0nB28L2T9r13aG-9vHp20Jo0hhe7vPysU4UghfzGfJm_6LGR2XJA-jOzMctrku19Xq3QuNkeGw0wSGw077OwAA__8_ONb5">