[PATCH] D31042: Allow DataLayout to specify addrspace for allocas.

John McCall via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 27 18:02:22 PDT 2017


rjmccall added a comment.

In https://reviews.llvm.org/D31042#711662, @arsenm wrote:

> In https://reviews.llvm.org/D31042#711661, @rjmccall wrote:
>
> > In https://reviews.llvm.org/D31042#711648, @arsenm wrote:
> >
> > > LLVM treats 0 as the "generic" address space. This is how the LangRef refers to it.
> >
> >
> > You're revising LangRef here one way or the other.  I'm suggesting that a better revision would be to stop saying that address space 0 is the "generic" address space (because there is no such thing), and instead say that it is the address space of the stack.  Is there anything actually preventing you from doing that?
>
>
> Yes. The pointer size of the stack smaller than the pointer size for code or most other memory. 0 is a valid, dereferencable pointer for the stack address space


I don't see why the pointer size has anything to do with it.  In the absence of target-specific information, LLVM is not allowed to assume that one address space is subsumed by another address space at all.  It doesn't matter if one of them is address space 0.

The special treatment of zero pointers is an interesting point, but again, I feel like that transformation could be made target-dependent *much* more easily than this.  This is an incredibly invasive change.


https://reviews.llvm.org/D31042





More information about the llvm-commits mailing list