https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65206
--- Comment #9 from rguenther at suse dot de <rguenther at suse dot de> --- On Mon, 2 Jan 2017, jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65206 > > --- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > Adding some flag on the MASK_STORE or MASK_LOAD is not hard, it can be in > another argument, or some GF_*, whatever. But I don't understand here what is > the difference between originally pointer based and array based access. > Doesn't for non-masked stores or loads forwprop propagate array accesses into > pointer stores/loads anyway? The issue is that dependence analysis can't handle mixed pointer / array accesses (it would need to treat the array access as pointer-based, thus comment #5 which talks about always providing both sets of DR->indices variants). Yes, forwprop propagates the loads/stores but it correctly conservatively handles propagating p = &a[i] to *p (it doesn't propagate) or p = &a[1] to *p (it creates MEM[a, 4], not an array access). The "hack" forwards it as array access to make dependence analysis happy. The real fix is comment #5 computing (maybe lazily) a DR->indices variant for array accesses using get_inner_reference on the full reference and analyzing it as MEM[base + offset, bitoff], thus if it were *&ref. That makes more refs "compatible" for initialize_data_dependence_relation. Implementation-wise it's not that easy to implement this though :/