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

    <tr>
        <th>Summary</th>
        <td>
            Loss of `addrspace` attribute when canonicalizing `getelementptr` instruction
        </td>
    </tr>

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

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

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

<pre>
    Hi @nikic !

I see that you landed a patch ([Link](https://github.com/llvm/llvm-project/commit/90ba33099cbb17e7c159e9ebc5a512037db99d6d)) that standardizes the source pointer type of Geps to i8 type. However I noticed that instructions of the type:
```
%gep = getelementptr ptr addrspace(1), ptr %ptr, i64 42
```
get modifiied to 
```
%gep = getelementptr i8, ptr %ptr, i64 42
```

thereby losing the addrspace(1) attribute. Is this the intended behaviour of this patch(which I believe should not be)? 
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyUk9uOmzAQhp_G3IwameHoCy52G6UbadV3MPYEpkswsk2i7NNXhlbbVr1ZCQw2msP_8Y8OgYeZqBPVs6iOmV7j6Hz3nf2ofdY7--heGEQpZ35jAwJzIY9CPu3rGQIRxFFHeLgVJj1bsqBh0dGMILAV1fMrz2-iOgpsxxiXIIongSeBp4HjuPYH464CT9N0-_34snj3g0wUeDLueuX0omSvi0IqZfo-b6gxeaVIUW8qXeUoi8b2StnaClQC1d5QiHq22lt-pwBxJAhu9YZgcTxH8hAfC4G7wDdaAkQH3G5HB3hxd7qRhzPMLrIhu-fjOUS_mshuDikupUwBSdCOpJa_rn2L1UALiOIIA0Wa6EpzXKKHdGtrfVi0IYFtvnX9dTsXWC3Rpx3XJZT438wDRbg6yxfm1JyDz9Xn9lPV9jWO5Kl_wOQCz8Mm_l8NoGP03K-RDnBOyHnnnnBvvuhp1Dd2q9_xcdh9IrC9j2xGOENPE9ONIIxunWziDz0lPMUJMtsVVhVKZ9TljaxLVDU22dhRXVhVVVo11BBKrdDUl0I2qlGXi2ow4w4lljLHVrZ5UTaHPkepTE54wbxpKxKlpKvm6ZD8d3B-yDiElbpGNUWVTbqnKWwDgjjTHbaPAjHNi-82z_brEEQpJw4xfGSJHCfqXl3YDCNq-YGslh-44D7SDEbPbmajJ35PhEUt__ptKeIPC2arn7pPD9TWeRB42pT9DAAA___FPT_N">