[PATCH] SROA fix to avoid invalid bitcast generation when converting a load from a double pointer bitcasted with an address space change of the pointee pointee

Michele Scandale michele.scandale at gmail.com
Fri Mar 7 12:11:32 PST 2014


On 03/07/2014 08:39 PM, Chandler Carruth wrote:
>
> On Fri, Mar 7, 2014 at 11:35 AM, Matt Arsenault <arsenm2 at gmail.com
> <mailto:arsenm2 at gmail.com>> wrote:
>
>     On Mar 7, 2014, at 11:18 AM, Chandler Carruth <chandlerc at gmail.com
>     <mailto:chandlerc at gmail.com>> wrote:
>
>>     1) I don't understand why we don't allow bitcasting between address spaces
>>     when they are the same size. We have the datalayout embedded in the
>>     module, we should be able to verify this, etc etc. Breaking the same-size
>>     "as if" semantics of bitcast seems a pointless limitation.
>>
>
>     Pointers with different address spaces may have different representations
>     and could need a nontrivial transformation between them.
>
>
> Yes, I'm suggesting that bitcast should *not* do what addrspacecast does, but
> shoudl do what storing and loading the bits does.
>
> This might produce a garbage pointer, but garbage in, garbage out. Making it
> invalid IR seems like it makes things like SROA unnecessarily complex.

I think that before the introduction of addrspacecast, bitcasting pointers 
between address spaces was used also for other semantics.

It could be possible, in this way addrspacecast instructions can be "optimized" 
to bitcasts for those targets that have bitcast semantic for addrspacecasts, but 
it should be equivalent to ptrtoint+inttoptr, picking an integer type of the 
same size of the pointers....


>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>




More information about the llvm-commits mailing list