[llvm] r188507 - Don't do FoldCmpLoadFromIndexedGlobal for non inbounds GEPs

Eli Friedman eli.friedman at gmail.com
Fri Aug 16 23:56:35 PDT 2013


Err, right, sorry, haven't worked with this stuff in a while.

-Eli


On Fri, Aug 16, 2013 at 10:01 PM, Dan Gohman <dan433584 at gmail.com> wrote:

> That's actually not valid with either kind of getelementptr.
>
> See "Can I compute the distance between two objects, and add that value to
> one address to compute the other address?" in the GetElementPtr FAQ.
>
> Dan
>
> On Fri, Aug 16, 2013 at 6:30 PM, Eli Friedman <eli.friedman at gmail.com>wrote:
>
>> Because if we don't have inbounds, it could point at a different object
>> in a defined way, e.g. "x[(uintptr_t)&y - (uintptr_t)&x]".
>>
>> -Eli
>>
>>
>> On Fri, Aug 16, 2013 at 6:24 PM, Dan Gohman <dan433584 at gmail.com> wrote:
>>
>>> In that case, why do you need to check inbounds at all?
>>>
>>> Dan
>>>
>>>
>>> On Fri, Aug 16, 2013 at 5:40 PM, Matt Arsenault <
>>> Matthew.Arsenault at amd.com> wrote:
>>>
>>>>  On 08/16/2013 11:40 AM, Dan Gohman wrote:
>>>>
>>>> On Thu, Aug 15, 2013 at 4:11 PM, Matt Arsenault <
>>>> Matthew.Arsenault at amd.com> wrote:
>>>>
>>>>> Author: arsenm
>>>>> Date: Thu Aug 15 18:11:07 2013
>>>>> New Revision: 188507
>>>>>
>>>>> URL: http://llvm.org/viewvc/llvm-project?rev=188507&view=rev
>>>>> Log:
>>>>> Don't do FoldCmpLoadFromIndexedGlobal for non inbounds GEPs
>>>>>
>>>>
>>>>  I don't see how inbounds is meaningful here. inbounds includes "one
>>>> past the end" pointers, so there is no guarantee that a load from an
>>>> inbounds getelementptr pointer value will load from within the bounds of
>>>> the object.
>>>>
>>>>  Dan
>>>>
>>>>    If you actually load past the end of the object it's undefined, so
>>>> it doesn't matter
>>>>
>>>
>>>
>>> _______________________________________________
>>> llvm-commits mailing list
>>> llvm-commits at cs.uiuc.edu
>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130816/a7b3eeff/attachment.html>


More information about the llvm-commits mailing list