<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/81464>81464</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AMDGPU][GlobalISel] Assertion failure in constant folding in buildPtrAdd
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:AMDGPU,
llvm:globalisel,
crash-on-valid
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
jayfoad
</td>
</tr>
</table>
<pre>
On this [test case](https://github.com/llvm/llvm-project/files/14237614/r.txt) I get:
```
$ llc -mtriple=amdgcn -mcpu=gfx1030 -global-isel r.ll
llc: lib/Support/APInt.cpp:198: llvm::APInt &llvm::APInt::operator+=(const llvm::APInt &): Assertion `BitWidth == RHS.BitWidth && "Bit widths must be the same"' failed.
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUkkFvnD4QxT_NcLEWmTF4lwMH9o_IP4eqUaOqZ2MbcGowsk2afPvKbNpUUS-VkIBn5s3wmydCMNOqdQPVFaouE3ucnW-exOvohMoGp16bzyuJswkEqmvUIRIpgoaqA7zMMW4BWAvYA_aTifM-5NItgL21z79up827Jy0jYD8aqwNgX5TIzrwoAXufx5cIWJN7MumYzGgHtAVO367bK5bEWklOS_RmsxpYJxY1yZWcFrntwLppfCkoo-Q0WTcIezJBW-Jza28G1kpgLbFmAOwf921zPg3UPtyvMZfbBqwt6svxSZqctcDa45AA8g_S7dFt2ovoPOAVWKIh3Rri38oB62TchqB9NG4lwOnVxG9GxZmkWtaRL_8_5u9aquEEEK8mkh9JC2TZQySDJnHWJIhFAyLgmYzCWK3yD9Qy1TBVs1pkuinO9HxmvGB1Nje6ErIokRcjXoaRl0KWVS1GqsZKF5zSzDRIsaRYYFHQS1Xn_MJrzZWqK84YrxFKqhdhbJ7-NHd-ykwIu24uRcnLzIpB23DECXEQ8rteVWLxqbt7-HqM_B8gvkG6rSpt6veJ9CLMJ7eenoU1KslVl_nmyNGwTwFKak2I4b17NNEe-X3rUXVQXe8O5_tHbaHq_iCfaO1eE7OSY11ijWR0Vpl1StqwG6seom-VynZvm38O-IEiJfyg8TMAAP__rQ0Ghg">