[PATCH] D11242: Fix assert when inlining a constantexpr addrspacecast
Matthew.Arsenault at amd.com
Sun Jul 26 09:47:33 PDT 2015
arsenm added a comment.
In http://reviews.llvm.org/D11242#212156, @hfinkel wrote:
> > Accumulating the offset through the addrspacecast doesn't make much sense
> Why does it not make sense? It just means that the base object is in a different address space from the original derived pointer. The LangRef says:
> > Note that if the address space conversion is legal then both result and operand refer to the same memory location.
> and so, unless the addresscast were somehow illegal (is that possible for a constant expression addresscast?) then it should have a well-defined meaning. Am I missing something?
The addrspacecast can totally change the representation of the pointer. In the case I ran into, the original pointer is a 32-bit offset into special on chip memory being casted to a 64-bit address space. The pointer is converted to a full virtual 64-bit address which will resolve to the same location, but doesn't have a common base with the original pointer, so there isn't a simple add relationship between the two.
More information about the llvm-commits