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

    <tr>
        <th>Summary</th>
        <td>
            What is the correct addrspace for ptr argument of var.annotation ?
        </td>
    </tr>

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

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

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

<pre>
    LangRef says:
`The first argument is a pointer to a value, the second is a pointer to a global string, the third is a pointer to a global string which is the source file name, and the last argument is the line number.`

so if I read it correctly it has no restrictions regarding what address spaces are legal and I would assume that any address space can be used. But meanwhile for to following declaration:
`declare void @llvm.var.annotation(ptr addrspace(4), ptr, ptr, i32, ptr)`
llvm-as generates:
```
 assembly parsed, but does not verify as correct!
Intrinsic has incorrect argument type!
void (ptr addrspace(4), ptr, ptr, i32, ptr)* @llvm.var.annotation
```
so the validator doesn't accept it.
This error seems to be unreasonable and in some cases even undesirable, for example in OpenCL addrspace(4) is a generic AS generated by clang.

So the question is: is it intentional or it's a bug in the validator?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJydU91r2zAQ_2vsF1Fjy87Xgx_SlkChY7AW9ixbZ1tDljxJTpf_fndykjVbx2BgEk466X5faqw81c_C9F-gY16cfFLuk_wxyffJOn8dgHXK-cCE6-cRTGDKM8Emq0wAx4LF4ij0DAl_YAG7PbTWyA-6em0boZkPTpn-0h0G5f7ZzN4G1Q7UFQfY2bWESgMzYoyDBU6kPS1-QxoXlcHOeWzAZUjpzC3-estUx56YA4EoAmutc9AGfaJiEJ4Zi3uEog3KGo9FL5xcMAkcJSVue-Yn0QKScDgNO3QE9MTe7KwlE94jHoRCB8zp9hBrhWENsNmDzNj9HNgIwiBhZNfZqEZntbZvNFNCq4UTBOW9ScsysKNVkiVVrvVxzI7CZcIYG5Z2vp2Ci6PjWKyrhO9IO1x_96dKfq12V7XoxjuUowcDOB9uMnL-YklkYWxQwEk4pER3NUhKWiAxAzuCUx1q4C9aJ7xYjj4ZMturNgqvzHn_l53hNMG1e-H6f6z4_m8qfUQJM0IpwpArKQJaQlxQ0A1Ca1uYMGchW1pfB4wcOIdNHmD05B55azBf3hrRoKmUDGUwxSN571EWOILBHgleOWohpGQ9_BDjhCew-_ME5uH5D6LLw4mmoGz7l6s_kjUnhqEwffY-7i8Lle8zRhrp4nH0kS7BtNPjM7SK6cXhCo3Z0O3N3BOCGwmS8pBCXazXq6LalkWRyrqUu3In0qCChvorRf38-q42XrBHbtG2i7G2Y7c-MBowO10PIUwxa_yAX6_CMDdZa0csyL7z393k7LcYpYPCt4bp5IfVlvNNOtRVtxF5UTZrgI7LbcXzvNhwuSkrLnYV8FSLBrSvk9V9snpMVc1zzos83xTIa1Vk66LcdRtYVyvYFt2qxODAKJTOYnys61NXRwyok6dUKR_8r018Dqo3AJf7xRwG6-pP7kVJNfo04q0j2J8meNVw">