<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 21, 2019 at 3:14 PM Savonichev, Andrew via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org">llvm-dev@lists.llvm.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Gleb Popov via llvm-dev writes:<br>
> I have the following IR:<br>
<br>
> %x = alloca i32, align 4<br>
> %p = alloca i32*, align 8<br>
> store i32* %x, i32** %p, align 8<br>
><br>
> Now I change module's data layout and run InferAddressSpacePass. This turns that piece of code into<br>
><br>
> %x = alloca i32, align 4, addrspace(1)<br>
> %p = alloca i32*, align 8, addrspace(1)<br>
> store i32 addrspace(1)* %x, i32* addrspace(1)* %p, align 8<br>
><br>
> But Verifier complains that the module is invalid, saying<br>
><br>
> error: stored value and pointer type do not match<br>
> store i32 addrspace(1)* %x3, i32* addrspace(1)* %p4, align 8<br>
><br>
> I didn't even manage to write correct IR manually in presence of addrspace().<br>
> Is it a bug, or I'm missing something?<br>
<br>
`i32* addrspace(1)*' is a pointer in addrspace(1) that points to a pointer in<br>
addrspace(0) (zero address space is not printed). In other words, pointee type<br>
of `p' is `i32*', while you're trying to store `i32 addrspace(1)*'. You have to<br>
change the alloca to make it work:<br>
<br>
%p = alloca i32 addrspace(1)*, align 8, addrspace(1)<br>
store i32 addrspace(1)* %x, i32 addrspace(1)* addrspace(1)* %p, align 8<br></blockquote><div><br></div><div>Ah, that's why stars are in different places! Thanks for clearing this up.<br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
--<br>
Andrew<br>
_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
</blockquote></div></div>