[PATCH] D20665: Claim NoAlias if two GEPs index different fields of the same struct
Daniel Berlin via llvm-commits
llvm-commits at lists.llvm.org
Wed Jun 1 19:03:11 PDT 2016
and the obvious modification still gives right answers (ie using x->a):
%5 = getelementptr inbounds %struct.A, %struct.A* %x, i32 0, i32 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i32 0, i32 0
%7 = getelementptr inbounds i8, i8* %6, i64 %4
%8 = load i8, i8* %7, align 1
%9 = zext i8 %8 to i32
%10 = getelementptr inbounds %struct.A, %struct.A* %x, i32 0, i32 1
%5 and %10 do *not* alias.
The code says nothing about %10 and %6 or %7
On Wed, Jun 1, 2016 at 7:01 PM, Daniel Berlin <dberlin at dberlin.org> wrote:
> Errr, this is not two GEPS of a struct type base pointer with the same
> type, with a minimum of two operands, etc.
>
> It's
> %6 = getelementptr inbounds i8, i8* %5, i64 %4
> %9 = getelementptr inbounds %struct.A, %struct.A* %x, i32 0, i32 1
>
> This code will do nothing with this.
>
> Want to try again?
> :)
>
>
> On Wed, Jun 1, 2016 at 5:49 PM, Eli Friedman <eli.friedman at gmail.com>
> wrote:
>
>> eli.friedman added a comment.
>>
>> Example:
>>
>> struct A {
>> unsigned char a[10];
>> unsigned char b;
>> };
>> void f(A* x) {
>> for (unsigned i = 0; i < 11; ++i)
>> x->b += ((unsigned char*)x)[i];
>> }
>>
>>
>> Repository:
>> rL LLVM
>>
>> http://reviews.llvm.org/D20665
>>
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160601/a8092204/attachment.html>
More information about the llvm-commits
mailing list