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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
So I think what safelen > 1 (and thus ivdep) guarantees is that (even if the
loop doesn't iterate) we can peel any iteration before or after the loop which
effectively means all references in one iteration are independent of all refs
in another iteration.  It also allows unrolling and interleaving the unrolled
iterations arbitrarily.  But we have to preserve ordering of stmts in a single
iteration.

Now - for refs that have an invariant address in such loop the interleaving
effectively means that they are independent even in the same iteration.  Which
of course raises the question of whether ivdep or safelen specifications say
anything about must-aliases or if they really allow

 # safele = 2 / ivdep
 for (i = 0; i < 2; ++i)
  {
   tem = c;
   c = tem + 1;
  }

to be re-written as (unroll, interleave):

  tem0 = c;
  tem1 = c;
  c = tem1 + 1;
  c = tem0 + 1;

for example.  I suppose it's not their intent.  So maybe there's an additional
restriction on the interleaving?  Preserve iteration order of individual
stmts?  That would prevent autopar in face of just ivdep for example.

Note that any "handle must-defs 'correctly'" writing is inherently fishy.

Reply via email to