Fwd: [PATCH] Teach MergeFunctions about address spaces
Matt Arsenault
Matthew.Arsenault at amd.com
Mon Sep 16 12:18:16 PDT 2013
On 09/16/2013 06:22 AM, Stepan Dyatkovskiy wrote:
> Currently, MergeFunctions allows casts from from Pointer to Int, so we
> mark next function types as equals (in case of 64bit memory address):
>
> void foo(i64 ptrvalue)
> void voo(i8* ptr)
>
> How we should treat in this case pointer from addrspace(1)?
>
> void voo2(i8 addrspace(1)* ptr)
>
> Should it be equal to 'foo'? If so, taking into account transitivity
> of 'equal' it also would be equal to 'voo'.
>
If addrspace(1) is not also 64-bit, then this is definitely not OK. Even
if it is, I don't think this is generally safe. On AMD GPUs at least,
loads/stores to different address spaces use a different set of
instructions. If voo and voo2 actually use the pointers, the functions
will not be the same. It would only be OK if it was only doing
addressing calculations. Soon bitcasts aren't going to be allowed
between address spaces, and merging voo and voo2 assumes that is OK.
More information about the llvm-commits
mailing list