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

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the following is the correct fix.

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c        (revision 250659)
+++ gcc/tree-vect-loop.c        (working copy)
@@ -6071,8 +6071,10 @@ vectorizable_reduction (gimple *stmt, gi
     {
       /* Only call during the analysis stage, otherwise we'll lose
         STMT_VINFO_TYPE.  */
-      if (!vec_stmt && !vectorizable_condition (stmt, gsi, NULL,
-                                               ops[reduc_index], 0, NULL))
+      if (!vec_stmt
+         && (reduc_index == -1
+             || !vectorizable_condition (stmt, gsi, NULL,
+                                         ops[reduc_index], 0, NULL)))
         {
           if (dump_enabled_p ())
            dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,

Reply via email to