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

--- Comment #2 from vries at gcc dot gnu.org ---
All but the static omp schedules use expand_omp_for_generic. There does seem to
be some ssa support in expand_omp_for_generic.

If we revert "Don't cancel loop tree in parloops" (r226427) to eliminate
disturbance from that patch, what doesn't seem to work is reductions. 

We can see here that there's an inner loop PHI for sum in bb4.
...
f._loopfn.0 (void * .paral_data_param)
{
  int i.9;
  unsigned int sum.7;
  long int .iend0.15;
  long int .istart0.14;
  unsigned int * restrict a.10;
  unsigned int n.8;
  long int _6;
  _Bool _7;
  long int _8;
  unsigned int ivtmp_9;
  long int _10;
  unsigned int _11;
  unsigned int ivtmp_14;
  unsigned int ivtmp_15;
  long unsigned int _19;
  long unsigned int _20;
  unsigned int * _21;
  unsigned int _22;
  _Bool _25;
  unsigned int * _27;

  <bb 2>:
  n.8_4 = MEM[(struct  *).paral_data_param_1(D)].n;
  a.10_5 = MEM[(struct  *).paral_data_param_1(D)].a;
  _6 = (long int) n.8_4;
  _7 = __builtin_GOMP_loop_dynamic_start (0, _6, 1, 1, &.istart0.14,
&.iend0.15);
  if (_7 != 0)
    goto <bb 3>;
  else
    goto <bb 6>;

  <bb 3>:
  _8 = .istart0.14;
  ivtmp_9 = (unsigned int) _8;
  _10 = .iend0.15;
  _11 = (unsigned int) _10;

  <bb 4>:
  # sum.7_12 = PHI <sum.7_13(4), 0(3)>
  # ivtmp_14 = PHI <ivtmp_15(4), ivtmp_9(3)>
  i.9_18 = (int) ivtmp_14;
  _19 = (long unsigned int) i.9_18;
  _20 = _19 * 4;
  _21 = a.10_5 + _20;
  _22 = *_21;
  sum.7_13 = sum.7_12 + _22;
  ivtmp_15 = ivtmp_14 + 1;
  if (_11 > ivtmp_15)
    goto <bb 4>;
  else
    goto <bb 5>;

  <bb 5>:
  _25 = __builtin_GOMP_loop_dynamic_next (&.istart0.14, &.iend0.15);
  if (_25 != 0)
    goto <bb 3>;
  else
    goto <bb 6>;

  <bb 6>:
  # sum.7_26 = PHI <sum.7_13(5), 0(2)>
  __builtin_GOMP_loop_end_nowait ();
  _27 = &MEM[(struct  *).paral_data_param_1(D)].sum.7;
  __atomic_fetch_add_4 (_27, sum.7_26, 0);
  return;

}
...

What is missing, is the outer loop phi for sum in bb3.

Reply via email to