[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 14 05:38:33 PDT 2014


On 03/07/2014 10:38 PM, Matt Arsenault wrote:
> On 03/07/2014 01:28 PM, Chandler Carruth wrote:
>>
>> On Fri, Mar 7, 2014 at 1:21 PM, Michele Scandale <michele.scandale at gmail.com
>> <mailto:michele.scandale at gmail.com>> wrote:
>>
>>     So you suggest to allow bitcast between pointer of different address
>>     spaces but with the same size. Is is correct?
>>
>>
>> Yes, that is part of my suggestion, but not all of it (see the second part of
>> the original mail).
>>
>> However, we shouldn't do that without confirming with others that this works.
>> Adding Owen to the CC-list.
>>
>
> I think it makes sense, although it will make it a bit harder to find the most
> common address space bugs. Disallowing bitcasts between address spaces also
> removed some questions about what to do with casts involving address spaces when
> there was no datalayout, but I guess that soon won't be a problem anymore.

Yes, with the DataLayout embedded in the module it won't be a problem. BTW, 
allowing bitcast operation between pointer to different address spaces solves 
the problem only if both types have the same bit length.
The original problem still holds for pointer to different address spaces of 
different bit lengths: it would be fine to use at least in this case the pair 
ptrtoint+inttoptr?



More information about the llvm-commits mailing list