[llvm-dev] [LLVMdev] Moving towards a singular pointer type

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Mon Apr 17 08:08:29 PDT 2017


On Mon, Apr 17, 2017 at 7:19 AM James Courtier-Dutton <
james.dutton at gmail.com> wrote:

> On 16 April 2017 at 22:24, David Blaikie <dblaikie at gmail.com> wrote:
>
>>
>>
>> On Sun, Apr 16, 2017 at 2:34 AM James Courtier-Dutton via llvm-dev <
>> llvm-dev at lists.llvm.org> wrote:
>>
>>> Hi,
>>>
>>> Did this work ever get done? There was a long thread about it back in
>>> 2015.
>>>
>>> I wish to use IRBuilder.
>>> Is there any documentation?
>>> How do I use the singular pointer type in GEP, LOAD, STORE instructions?
>>>
>>
>> Sorry, no, the work is not complete - for now you'll need to pass the
>> pointer and pointee type to a few of these functions and some will do it
>> for you (Getting the pointee type from the pointer type, etc). I'll
>> hopefully be coming back around to this in 6-9 months to continue on it
>> (finishing off one or two IR constructs, then making sure all the
>> optimizations can cope with this)
>>
>> - Dave
>>
>
> Hi Dave,
>
> I think if the optimizations changed from the concept of the pointer
> having a type, to instead the memory location itself having the type.
>

Not sure I quite follow, but I'll say this:

Memory locations in LLVM are already, as I understand it, typeless - it's
never incorrect to bitcast a pointer to A to a pointer to B and then use it
(I mean, you get whatever bits were there).

The goal of the typeless pointer work is to align the types closer to this
reality, so that optimizations/transformations aren't mislead by
meaningless type information.


> Then we might make some good progress in improving the optimizations.
> If one has the concept of the memory location itself having a type, it is
> then obvious that any GEP operation is likely to result in a pointer to a
> different memory location, and therefore have a different type. So, giving
> a pointer a type is not particularly useful.
> If the pointer having a type is useful in some way to optimizations, then
> the GEP instruction should really be a combined GEP and BITCAST instruction.
>
> The singular pointer type (i.e. type-less) goes some way towards achieving
> this.
>
> Kind Regards
>
>
> James
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170417/5106ece1/attachment.html>


More information about the llvm-dev mailing list