[llvm-dev] Field sensitive alias analysis?

Daniel Berlin via llvm-dev llvm-dev at lists.llvm.org
Thu Dec 10 08:09:29 PST 2015

>> Opps, you are right in my example basicaaa could do it potentially.
> Correct example is slightly different:
> int foo(struct S *ps, int i) {
>   ps->a[i] = 1;
>   ps->b = 2;
>   return ps->a[i];
> }
> Here basicaa cannot make sure that 'ps->a[i]' doesn't change after 'ps->b
> = 2' because if 'i == 10' all 3 memory accesses will read/write the same
> memory. And type information about S::a is required to disambiguate. With
> current TBAA 'ps->a[i]' is about random 'int' read.

Yes, and without more info, in LLVM that read can legally touch ps->b.
So that makes sense.

>> Missing information here is the range inside struct S that could be
>>> accessed.
>> What do you mean by "could be accessed".  Do you mean "valid to access in
>> C"?
> By access I meant read/write memory i.e. that size of S::a inside the
> struct or at least information that only S::a is accessed in this place
> i.e. not S::b.


So what you want sounds reasonable to me ;-)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20151210/ce6af2f2/attachment.html>

More information about the llvm-dev mailing list