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

    <tr>
        <th>Summary</th>
        <td>
            [InferAddressSpaces] Verifier crash after inserting `addrspacecast` before phi-node
        </td>
    </tr>

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

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

    <tr>
      <th>Reporter</th>
      <td>
          Kerang-BR
      </td>
    </tr>
</table>

<pre>
    The `infer-address-spaces` pass attempts to insert `addrspacecast` instructions before phi-node in some corner cases. This triggers the verifier crash when compiling.

See details in https://godbolt.org/z/1nW61Pc75
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJxs0c1u3CAQB_CnwRdkC_Aarw8cNoosVb1UTdSe-Zi1qTBYDN6offqK3UhVo5w48J9hmJ9G9EsEUGR4IsNzo4-ypqy-QtZxaZ--Nya53-p1BUok8_EKudXOZUBscdcWkEhGd41IdSmw7QVpSdRHhFxqSQ3fg1ZjqVkfseTDFp8iUgPXlIHuq29jckB9pJg2oDblCJlajYAdfV090pL9skBGWlagN8j-6msia1zp2wqR2rTtPvi4dIRdCLu8AFAHRfuAte9ayo6kvxAxEzEvyZkUSpfyQsT8h4iZx5-Sf7Pj0DjVu6mfdAOKj5Jxee6nsVmV7Z2ZzkJI1xvjGEhhjB7PwK_DpHstG68EEwNnnLOxn4axO52k7Lk72ZFzPvWcnBhs2ocuhNtW32484gGKSzGdRRO0gYB3CSEivNH7LRGiwmRVi1pzLEhOLHgs-K9N8SXcCb9UocsD6OXhMzzTH_-vS18L5HcjH5dPmT7INEcO6sMKfVkP09m0ETHXSd6Pds_pF9hCxHyfH-tyHx-8KfE3AAD___VVzkI">