[llvm-commits] [llvm] r96598 - /llvm/trunk/docs/AdvancedGetElementPtr.html
Dan Gohman
gohman at apple.com
Mon Feb 22 11:06:33 PST 2010
On Feb 22, 2010, at 1:14 AM, Török Edwin wrote:
> On 02/18/2010 08:40 PM, Dan Gohman wrote:
>> Author: djg
>> Date: Thu Feb 18 12:40:29 2010
>> New Revision: 96598
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=96598&view=rev
>> Log:
>> Clarify that ptrtoint+inttoptr are an alternative to GEP which are
>> not restricted by the GEP rules.
>>
>> Modified:
>> llvm/trunk/docs/AdvancedGetElementPtr.html
>>
>> Modified: llvm/trunk/docs/AdvancedGetElementPtr.html
>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/docs/AdvancedGetElementPtr.html?rev=96598&r1=96597&r2=96598&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/docs/AdvancedGetElementPtr.html (original)
>> +++ llvm/trunk/docs/AdvancedGetElementPtr.html Thu Feb 18 12:40:29 2010
>> @@ -200,9 +200,9 @@
>> to null?</b></a>
>> </div>
>> <div class="doc_text">
>> - <p>You can compute an address that way, but you can't use that pointer to
>> - actually access the object if you do, unless the object is managed
>> - outside of LLVM.</p>
>> + <p>You can compute an address that way, but if you use GEP to do the add,
>> + you can't use that pointer to actually access the object, unless the
>> + object is managed outside of LLVM.</p>
>>
>> <p>The underlying integer computation is sufficiently defined; null has a
>> defined value -- zero -- and you can add whatever value you want to it.</p>
>> @@ -211,6 +211,11 @@
>> object with such a pointer. This includes GlobalVariables, Allocas, and
>> objects pointed to by noalias pointers.</p>
>>
>> + <p>If you really need this functionality, you can do the arithmetic with
>> + explicit integer instructions, and use inttoptr to convert the result to
>> + an address. Most of GEP's special aliasing rules do not apply to pointers
>> + computed from ptrtoint, arithmetic, and inttoptr sequences.</p>
>
> Won't optimizers convert that back to a GEP?
No. They may have at one time, but that was fixed a while ago.
Dan
More information about the llvm-commits
mailing list