https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106019

rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|unassigned at gcc dot gnu.org      |rsandifo at gcc dot 
gnu.org
             Status|NEW                         |ASSIGNED

--- Comment #2 from rsandifo at gcc dot gnu.org <rsandifo at gcc dot gnu.org> 
---
Created attachment 53172
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53172&action=edit
Candidate patch

Huh, yeah, surprising this has been present so long.

Running aff_combination_expand on off2 before the query in
(from dr_may_alias_p):

      aff_tree off1, off2;
      poly_widest_int size1, size2;
      get_inner_reference_aff (DR_REF (a), &off1, &size1);
      get_inner_reference_aff (DR_REF (b), &off2, &size2);
      aff_combination_scale (&off1, -1);
      aff_combination_add (&off2, &off1);
      if (aff_comb_cannot_overlap_p (&off2, size1, size2))
        return false;

seems to fix it, but I guess that then adds the burden of
maintaining the cache.  Since we've already done similar
SSA_NAME expansion for DR_BASE_ADDRESS/DR_OFFSET, perhaps
we should just try to use that instead?  The attached patch
does that and fixes the testcase.

But maybe there are cases that aff_combination_expand
would handle and this patch wouldn't -- not sure.

Reply via email to