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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot 
gnu.org
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |ASSIGNED
   Last reconfirmed|                            |2022-08-05

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
The code should iterate and eventually distribute inner loops of perfect loop
nests.  In fact for

void bar (int *a, int * __restrict b)
{
  for (int k = 0; k < 10; k++)
    for (int j = 0; j < 100000; ++j)
      a[j] = b[j];
}

I do see

> ./cc1 -quiet t.c -O2 -fopt-info
t.c:4:23: optimized: Loop 2 distributed: split to 0 loops and 1 library calls.

the issue is likely that

void bar (int *a, int * __restrict b)
{
  for (int k = 0; k < 10; k++)
    {
    for (int j = 0; j < 100000; ++j)
      a[j] = b[j];
    __builtin_printf ("Foo!");
    }
}

causes distribution to fail early in find_seed_stmts_for_distribution and
that's taken as fatal error.  I have a fix.

Reply via email to