Fwd: [PATCH] Teach MergeFunctions about address spaces

Stepan Dyatkovskiy stpworld at narod.ru
Mon Sep 16 12:24:33 PDT 2013


So, If I got right, it depends on what voo and voo2 does? If it 
increments address - thats ok. If it loads/stores something - that 
shouldn't be merged.
Denying everything that is not allowed, we deny to merge it in generic 
case, but some functions still could me merged. Right?
-Stepan.

Matt Arsenault wrote:
> 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