[llvm-dev] RFC: Resolving TBAA issues

Ivan A. Kosarev via llvm-dev llvm-dev at lists.llvm.org
Sat Aug 19 11:27:32 PDT 2017


Daniel,

 > The whole point of TBAA is about whether you are
 > eliminate the loads/stores.  So yes, gcc is always
 > going to do the right thing, if you believe it's okay
 > to remove the load/stores.
 >
 > That's equivalent to saying "as long as it does
 > nothing or something, it was okay". :)

If it eliminates reload where it's not allowed, then wouldn't be okay. 
In this specific case it does not seem to violate the rules.

 > Assume we split it as you suggest,
 > into foo = *x, foo.i and bar = *b, b.a
 > *x contains a struct containing an int.
 > *b contains a struct containing a struct
 > containing an int
 > " an aggregate or union type that includes one of
 > the aforementioned types
 > among its elements or nonstatic
 > data members (including, recursively, an element or
 > non-static data member of a subaggregate
 > or contained union),"
 > This seems to fall into the "including, recursively" part.

The type of (*x) is not compatible with the type of (*b) or, 
recursively, type of b->i. Similarly, the type of (*b) is not compatible 
with (*x) or, recursively, x->i.

 > But, let's assume that is true for a second.
 > GIven
 > struct A *a
 > struct X *x
 >
 > a->i
 > x->i
 >
 > Can these accesses alias?

Given these definitions:

     struct A { int i; } *a;
     struct B { struct A a; } *b;

     struct X { int i; } *x;

No alias. struct X is not compatible with struct A.

 > struct B *b
 > struct X *x
 >
 > b->a.i
 > x->i

No alias. Same reason.

-- 



More information about the llvm-dev mailing list