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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-01-05
             Blocks|                            |53947
     Ever confirmed|0                           |1
           Keywords|                            |missed-optimization
             Status|UNCONFIRMED                 |NEW

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The issue is that we hit

  /* If this isn't a nested cycle or if the nested cycle reduction value
     is used ouside of the inner loop we cannot handle uses of the reduction
     value.  */
  if (nlatch_def_loop_uses > 1 || nphi_def_loop_uses > 1)
    {
      if (dump_enabled_p ())
        dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
                         "reduction used in loop.\n");
      return NULL;
    }

because cnt_21 is used in both the update and the COND_EXPR.  The reduction
doesn't fit the cond reductions we support but is a blend of a cond and
regular reduction.  Making the COND-reduction support handle this case should
be possible though.

Using 'int' we arrive at handled IL:

  # cnt_19 = PHI <cnt_8(7), 0(15)>
  _ifc__32 = _4 == _7 ? 1 : 0;
  cnt_8 = cnt_19 + _ifc__32;

so adjusting if-conversion can indeed help.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=53947
[Bug 53947] [meta-bug] vectorizer missed-optimizations

Reply via email to