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

    <tr>
        <th>Summary</th>
        <td>
            "llc" crashes when given file that attempts to use global pinned register
        </td>
    </tr>

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

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

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

<pre>
    I was experimenting with using pinned global registers, and the file I generated happened to trigger a crash in LLVM. It also prompted me to write a bug report, which is what I'm doing right now.

![image](https://user-images.githubusercontent.com/11416855/195329470-5c6fe71c-1ea8-4355-990f-fe69a2c48a7c.png)

File that triggers this crash:
```
; file: "global-register.ll"

define dso_local i64 @value_rbx() {
  %value = call i64 @llvm.read_register.i64(metadata !"rbx")
  ret i64 %value
}

declare i64 @llvm.read_register.i64(metadata) #0

attributes #0 = { nounwind readonly }
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyNVMmOnDAQ_Rq4lEDYYJYDh0xaLbU0ueY6MlCAI7PINtMzf58y0D2TWyTkNtT26tWrbpbus77BXVrAjxWNmnB2ah7grtwIm_XXVc0zdjDopZEaDA7KOjQ24D9Bzh24EaFXGuEGA85opCPnUa4r-ii3gDNqGNCAhNZIO4Ka4fX1968Ybg6ktgusZplWHzWh978b5ZC8m22gautinC91H1VLsZYu0sEt4MUE3eLxUfrRwbzc4yC5BMmP8-QsEC9qkgMG4hLwcnRutUFKhis9m0UT7VYbD9Tr1vgv7TI7IiBul4l8GMtYXgrhr5VIeZUVSSTavMeCtRFDWUZZKkRUVUkf9ZhXkrdZKYs2Xuch4NV3OFfPkPPQTzosvVE3OyUe1eGbJ-dzvKYvO7Vkh4DzYwLRYwKx1vTxe5EOezUjdHZ500tLw1J5BkGWvEu94ZtpPogGwgVB8XIEAKUVuxWC9AIU8ozR-n2KDcru7VmPLJRgQic76SR4hjnfs_Jnt0Ajc0eOM_MJsLj8i7TV0uB_F9tR8zT5nkM6orLZHNrdtHdAnZEStvmuSJk-4TLrT_gq_uA3xJrluRBFWhQi7Oq0q9JKhk45jTX1o3VL5zEd9JrDGQb1Tmf_HCTVR9Kt9Zol8TwW5FyXRyPhZnT9r_YOvZ0i862fPxEtwh9sSe5XZe2GtGJXUaaMh2OdYNE0mHVFlVdt3pV53nJRlGnfSZ6UaRpq2aC2NWme5B6qmiecs4RxxjgXIk55louOpUnDWpaIgkjHSSod79QvZghNvWOgrbN-IgTefhmltWqYER_55ebGxdS9wY7-NKiTRoY75noH_BeoQVjl">