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

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
So somehow

last_5 = _4 >= min_v_11(D) ? last_16 : i_17;

has been removed.  I see

last_5 = .FOLD_EXTRACT_LAST (...

in the IL now.  Removing old stmts during transform is really fragile...
(but yes, in-order reductions want to re-use the original cycle).

The following fixes the -1.c testcase (yeah, what a mess ;)).  Unfortunately
a cc1 cross refuses to make-check and I'm not wanting to manually
compile all of sve/*.c

Index: gcc/tree-vect-stmts.c
===================================================================
--- gcc/tree-vect-stmts.c       (revision 276564)
+++ gcc/tree-vect-stmts.c       (working copy)
@@ -10897,6 +10897,9 @@ vect_transform_stmt (stmt_vec_info stmt_
   stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info);
   if (!slp_node && STMT_VINFO_REDUC_DEF (orig_stmt_info)
       && STMT_VINFO_REDUC_TYPE (orig_stmt_info) != FOLD_LEFT_REDUCTION
+      && (STMT_VINFO_REDUC_TYPE (orig_stmt_info) != COND_REDUCTION
+         || (STMT_VINFO_VEC_REDUCTION_TYPE (orig_stmt_info)
+             != EXTRACT_LAST_REDUCTION))
       && is_a <gphi *> (STMT_VINFO_REDUC_DEF (orig_stmt_info)->stmt))
     {
       gphi *phi = as_a <gphi *> (STMT_VINFO_REDUC_DEF (orig_stmt_info)->stmt);
Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c        (revision 276564)
+++ gcc/tree-vect-loop.c        (working copy)
@@ -7901,7 +7901,10 @@ vectorizable_live_operation (stmt_vec_in
        return true;
       if (STMT_VINFO_DEF_TYPE (stmt_info) == vect_reduction_def)
        {
-         if (STMT_VINFO_REDUC_TYPE (stmt_info) == FOLD_LEFT_REDUCTION)
+         if (STMT_VINFO_REDUC_TYPE (stmt_info) == FOLD_LEFT_REDUCTION
+             || (STMT_VINFO_REDUC_TYPE (stmt_info) == COND_REDUCTION
+                 && (STMT_VINFO_VEC_REDUCTION_TYPE (stmt_info)
+                     == EXTRACT_LAST_REDUCTION)))
            return true;
          if (slp_node)
            {

Reply via email to