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

--- Comment #15 from Richard Biener <rguenth at gcc dot gnu.org> ---
Note even when promoting _2 to an array there wouldn't be any data dependence
between the actual refs.  There's a dependence between stmts, but that doesn't
exactly capture the issue either.  Consider

int a[1024], b[1024];

void foo()
{    
  for (int i = 0; i < 32; ++i)
    for (int j = 0; j < 32; ++j)
      for (int k = 0; k < 32; ++k)
        a[j] = b[k];
} 

where interchange of the two outer loops would be valid since b[k] doesn't
change.  Likewise

  for (int i = 0; i < 32; ++i)
    for (int j = 0; j < 32; ++j)
      for (int k = 0; k < 32; ++k)
        {
          b[k] = b[k] + 1;
          a[j] = 0;
        }

would be valid to interchange.  For the testcase at hand
tree_loop_interchange::valid_data_dependences only gets the l_1930[] update
as data-dependence that's not statically resolved.

If we'd have that ominous _2[i] and

  _2[i] = l_1930[k_26] + -1;
  l_1930[k_26] = _2[i];
  g_1731[_6] = _2[i];

we'd only have extra zero-distance DDRs here and we ignore those.

Reply via email to