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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2017-12-13
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
LIM has difficulties in disambiguating the 10 C[] refs against each other,
restrict doesn't help here.  LIM uses its own dependence code, not relying on
the data-dependence framework.

An issue might be that we can't expand (long unsigned int) (_286 + 1) further
in affine combination speak but we do expand (long unsigned int) (_286).
This results in

  /* The expansion of addresses may be a bit expensive, thus we only do
     the check at -O2 and higher optimization levels.  */
  if (optimize < 2)
    return true;

  get_inner_reference_aff (mem1->mem.ref, &off1, &size1);
  get_inner_reference_aff (mem2->mem.ref, &off2, &size2);
  aff_combination_expand (&off1, ttae_cache);
  aff_combination_expand (&off2, ttae_cache);
  aff_combination_scale (&off1, -1);
  aff_combination_add (&off2, &off1);

  if (aff_comb_cannot_overlap_p (&off2, size1, size2))
    return false;

ending up with

1603      if (aff_comb_cannot_overlap_p (&off2, size1, size2))
(gdb) p debug_aff (&off2)
{
  type = sizetype
  offset = 0
  elements = {
    [0] = (long unsigned int) (_286 + 1) * 8, 
    [1] = (long unsigned int) (l_n_70 * 10) *
0xfffffffffffffffffffffffffffffffffffffffffffffff8
  }
}

where _286 is the definition of l_n_70 * 10.

Note that also SCEV / data-ref analysis doesn't see the consecutive accesses,
likely because of the similar issue of the addresses being of the form

*(&C + (long unsigned int)((l_n_70 * 10) + l_m) * 8)

where there is possible wrapping in the l_n_70 * 10 + l_m computation in
unsigned int type.  loop bounds of course make it obvious this isn't the
case.

Let me see if I can cook up sth with a patch I have lying around providing
sth like get_range_info () for GENERIC exprs.  That way we could enhance
chrec_convert (and also affine_comb_expand).

Reply via email to