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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
Cleaned up testcase.

/* PR tree-optimization/90637 */
/* { dg-do compile } */
/* { dg-options "-fopenmp -O1 --param sink-frequency-threshold=90" } */

int v;

void
foo (int c)
{
  int i;
#pragma omp for simd if (c) lastprivate (v) schedule (static, 16)
  for (i = 0; i < 64; ++i)
    v = i;
}

This is something where I had initially punting rather than assert.
I must say what the sinking pass is doing looks very bad, mainly the sinking of
the omp_get_num_threads () from before the outer loop to inside of the outer
loop (but not inner loop), how that can ever be an advantage, instead of
calling it just once, call it several times?
For the reason of the ICE, sinking of the _1 = c_22(D) != 0, perhaps we could
add a hack/workaround to the sink pass not to sink with flag_openmp{,_simd} if
an immediate use is the .GOMP_SIMD_LANE call, or we could try to hoist it out
of the loop again (which wouldn't work if sinking sinks more than one statement
dependent on each other into the loop).

Reply via email to