[BasicAA] Try to disambiguate GEPs through arrays of structs into

Description

[BasicAA] Try to disambiguate GEPs through arrays of structs into
different fields.

We can show that two GEPs off of the same (possibly multidimensional)
array of structs, into different fields, can't alias. Quoting:

For two GEPOperators GEP1 and GEP2, if we find that:

  • both GEPs begin indexing from the exact same pointer;
  • the last indices in both GEPs are constants, indexing into a struct;
  • said indices are different, hence,the pointed-to fields are different;
  • and both GEPs only index through arrays prior to that;

this lets us determine that the struct that GEP1 indexes into and the
struct that GEP2 indexes into must either precisely overlap or be
completely disjoint. Because they cannot partially overlap, indexing
into different non-overlapping fields of the struct will never alias.

The other BasicAA::aliasGEP rules worked in some cases, but not all
(for example, the i32x3 struct in the testcase).
We can add this simple ad-hoc rule to complement them.

rdar://19717375
Differential Revision: http://reviews.llvm.org/D7453

Details

Committed
abFeb 7 2015, 9:04 AM
Differential Revision
D7453: [BasicAA] Add add-hoc rule to distinguish different fields in arrays of structs.
Parents
rL228497: SCEV: Compress disposition pairs.
Branches
Unknown
Tags
Unknown