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

    <tr>
        <th>Summary</th>
        <td>
            [AMDGPU] Uses SExt on indices in `isInterestingPHIIncomingValue`
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            backend:AMDGPU,
            crash
      </td>
    </tr>

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

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

<pre>
    ## Reproduction

https://godbolt.org/z/P97TT7fEs

## Cause

When `i1 true` is used as an index, SExt extends it to `i32 -1`. This would cause BitVector to overflow.
This can be a quick fix by using ZExt over SExt, as we have specified in the language manual that the index shall be treated as an unsigned number. (https://llvm.org/docs/LangRef.html#insertelement-instruction)
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJxckkFvnD4QxT-NuYwWgVkWOHDY7Gb__0itFKVJKvVm7AHcGHtrj5NNP30FoW3SC0i2572ZNz8Rgh4sYsvKK8b5UZA4OO_jmVAxzll5TESk0fn2w1XSOfXaMl4wXsAdnr1TUZJ2lmVHlu3fviPRObBiz_iJ8dPgVOcMpc4PjJ9-Mn66bar7-6q_Du-LVs2DiAHfn38d0QLbZToH8hHZLgMdIAZUIAIIC9oqvDB-gC_XFwK8EFoVQBOQW-oKDpuc7bIU7kcd4MVFo0DONnCl6RElOT-_dc_oe-Ne0jff5bEUFjoEAT-ilk_Q6wt0rxCDtgN8m-3mosV4bkAEeEEYxTNCOKPUvUYF2gKNCEbYIYoBYRI2CgM0CloulvYhjMKY2Yo8CvozW7TLlhTYOHXoU2C8_piuMc_TGq1yMjB--iTscId9OtJkGC-0DegJDU5oaaNtIL9ujDeJagvVFI1IsM2rPKuzbbWtkrHtscgzIVXf57wsmrrjHTa5wCKXRSO7MtEtz_g2K_KaFwXnVdr3dZPhrimbmteiLNk2w0lok_5uMNEhRGzrssqrxIgOTVjZ64R8QqtYsd9_Pv53-zDjxw-Mc-lFGFcYfTsLbbo4BLbNjA4U_kqTJrOQvAqUR3gIGN6IcAsiWmKYdzETEW4socdA2g63_9_cWOkmbYdHYRa-kuhN-w_DmsbYpdJNa-Trb3P27jtKYvy0jDfnv0z4KwAA____jhSS">