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

    <tr>
        <th>Summary</th>
        <td>
            [InstCombine] GEP-swap optimization should bitcast typed pointers
        </td>
    </tr>

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

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

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

<pre>
    After 6c767cef, the attached test case (using typed pointers) will assert on the types of the swapped GEPs. If typed pointers are not supposed to work any more, please let me know, we can make some workarounds in our local branch.
[reduced.txt](https://github.com/llvm/llvm-project/files/9974101/reduced.txt)

</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyVks9u3CAQxp_Gvoxigb3-d_BhkzRVbn0FDGObLAYLhm63T19wVbXKrRISDMPM9-OD2anHdF0IPXSy73qJS1G_AG0IgkjIDRUQBgIpAkJRDzFouwI9jpQ4nLapMhT1CHdtDIgQ0BM4ezbIhwK45QzCXRy55uuXb6GC9-VTCxAewTqCEI_Dhazq4O78DYR9wO48ZqzDYMYwSLAj3Ky75907JjoLu7glGZcSuU54F60KoC246ME4KQzMXli5VQV7Ldi1aJ89qihRVfSDivY13W4jOkLRXIv6LY1V0xbnSro9BcZ8_zM9Hd59oKQULtpguv_bOPYXznha_duzHn9LlTjxrhsYH8aRl2pq1NiMoiRNBqfE8W4Dvbh91hYTR_boKfsF7iC965-CdLI0bC4aBbOm9Bb0yb8yejP9N70OIZ747TAyXm4T6_qhVd1yYY3gki-j6ps2bfYDLu0yX0ojZjQhMyfQUk81q2vO2ciHpmt4hWxggmPLLgKxbdriwnAX2lRZuHJ-Lf10MsxxDSlpdKDwN5n-j14tnp4Udb1FYdcPlVZZTETanJ-k0ZZzXp7s0wn-C3wC6bA">