Gleb Popov via llvm-dev
2019-Jun-21 10:08 UTC
[llvm-dev] Using store with operands in non-zero address space
Hello, LLVM devs. I have the following IR: %x = alloca i32, align 4 %p = alloca i32*, align 8 store i32* %x, i32** %p, align 8 Now I change module's data layout and run InferAddressSpacePass. This turns that piece of code into %x = alloca i32, align 4, addrspace(1) %p = alloca i32*, align 8, addrspace(1) store i32 addrspace(1)* %x, i32* addrspace(1)* %p, align 8 But Verifier complains that the module is invalid, saying error: stored value and pointer type do not match store i32 addrspace(1)* %x3, i32* addrspace(1)* %p4, align 8 I didn't even manage to write correct IR manually in presence of addrspace(). Is it a bug, or I'm missing something? Thanks in advance. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190621/d4b752e0/attachment.html>
Savonichev, Andrew via llvm-dev
2019-Jun-21 11:14 UTC
[llvm-dev] Using store with operands in non-zero address space
Gleb Popov via llvm-dev writes:> I have the following IR:> %x = alloca i32, align 4 > %p = alloca i32*, align 8 > store i32* %x, i32** %p, align 8 > > Now I change module's data layout and run InferAddressSpacePass. This turns that piece of code into > > %x = alloca i32, align 4, addrspace(1) > %p = alloca i32*, align 8, addrspace(1) > store i32 addrspace(1)* %x, i32* addrspace(1)* %p, align 8 > > But Verifier complains that the module is invalid, saying > > error: stored value and pointer type do not match > store i32 addrspace(1)* %x3, i32* addrspace(1)* %p4, align 8 > > I didn't even manage to write correct IR manually in presence of addrspace(). > Is it a bug, or I'm missing something?`i32* addrspace(1)*' is a pointer in addrspace(1) that points to a pointer in addrspace(0) (zero address space is not printed). In other words, pointee type of `p' is `i32*', while you're trying to store `i32 addrspace(1)*'. You have to change the alloca to make it work: %p = alloca i32 addrspace(1)*, align 8, addrspace(1) store i32 addrspace(1)* %x, i32 addrspace(1)* addrspace(1)* %p, align 8 -- Andrew
Gleb Popov via llvm-dev
2019-Jun-21 13:41 UTC
[llvm-dev] Using store with operands in non-zero address space
On Fri, Jun 21, 2019 at 3:14 PM Savonichev, Andrew via llvm-dev < llvm-dev at lists.llvm.org> wrote:> Gleb Popov via llvm-dev writes: > > I have the following IR: > > > %x = alloca i32, align 4 > > %p = alloca i32*, align 8 > > store i32* %x, i32** %p, align 8 > > > > Now I change module's data layout and run InferAddressSpacePass. This > turns that piece of code into > > > > %x = alloca i32, align 4, addrspace(1) > > %p = alloca i32*, align 8, addrspace(1) > > store i32 addrspace(1)* %x, i32* addrspace(1)* %p, align 8 > > > > But Verifier complains that the module is invalid, saying > > > > error: stored value and pointer type do not match > > store i32 addrspace(1)* %x3, i32* addrspace(1)* %p4, align 8 > > > > I didn't even manage to write correct IR manually in presence of > addrspace(). > > Is it a bug, or I'm missing something? > > `i32* addrspace(1)*' is a pointer in addrspace(1) that points to a pointer > in > addrspace(0) (zero address space is not printed). In other words, pointee > type > of `p' is `i32*', while you're trying to store `i32 addrspace(1)*'. You > have to > change the alloca to make it work: > > %p = alloca i32 addrspace(1)*, align 8, addrspace(1) > store i32 addrspace(1)* %x, i32 addrspace(1)* addrspace(1)* %p, align 8 >Ah, that's why stars are in different places! Thanks for clearing this up.> -- > Andrew > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190621/535e9272/attachment.html>
Seemingly Similar Threads
- How to handle ISD::STORE when both operands are FrameIndex?
- How to handle ISD::STORE when both operands are FrameIndex?
- Legalized selection DAG differs for the same code and flags
- How to handle ISD::STORE when both operands are FrameIndex?
- RFC: alloca -- specify address space for allocation