[llvm-dev] Wrong description about getelementptr arguments?

David Blaikie via llvm-dev llvm-dev at lists.llvm.org
Sat Jun 17 11:26:13 PDT 2017


On Sat, Jun 17, 2017 at 11:20 AM 陳韋任 <chenwj.cs97g at g2.nctu.edu.tw> wrote:

> Documentation's a bit stale - it'd probably be enlightening/helpful to
>> look at some real world examples, such as:
>>
>> %arrayidx = getelementptr inbounds i32*, i32** %0, i64 3
>>
>> So the first argument (i32*) is a type, currently it's the same type as
>> the type that the second argument points to (or, in the case of a vector
>> gep, it's the type of the pointee of the elements of the vector argument).
>>
> ​So you mean we actually have three arguments here, ​i32*, i32** %0 and
> i64 3?
>

Right, though I can see how that could be a bit unclear/uncertain. Is the
first thing ('i32*') an argument, since it's only a type and no value?
Dunno - I could see using a few different phrasings... but probably as good
as any to refer to it as the first argument.


> The how about the following statement
>
>     The first index always indexes the pointer value given as the first
> argument
>
> it should be
>
>     The first index always indexes the pointer value given as the second
> argument
>
> ​right?
>

Yep, sounds right to me.


>
> I am okay sending patch to fix the document, btw. :)
>

Cool, thanks a bunch!


>
> Regards,
> chenwj​
>
>
> --
> Wei-Ren Chen (陳韋任)
> Homepage: https://people.cs.nctu.edu.tw/~chenwj
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170617/1c0b59f3/attachment.html>


More information about the llvm-dev mailing list