The direct_slp_reduc code in vect_create_epilog_for_reduction was
still assuming that all types involved in a reduction are the same
(up to types_compatible_p), whereas we now support differences in
sign.  This was causing an ICE in gcc.dg/vect/pr92324-4.c for SVE.
Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?

Richard


2019-12-10  Richard Sandiford  <richard.sandif...@arm.com>

gcc/
        * tree-vect-loop.c (vect_create_epilog_for_reduction): When
        handling direct_slp_reduc, allow the PHI arguments to have
        a different type from the vector elements.

Index: gcc/tree-vect-loop.c
===================================================================
--- gcc/tree-vect-loop.c        2019-12-10 11:30:23.506138368 +0000
+++ gcc/tree-vect-loop.c        2019-12-10 11:38:37.322774821 +0000
@@ -5054,6 +5054,8 @@ vect_create_epilog_for_reduction (stmt_v
              tree scalar_value
                = PHI_ARG_DEF_FROM_EDGE (orig_phis[i]->stmt,
                                         loop_preheader_edge (loop));
+             scalar_value = gimple_convert (&seq, TREE_TYPE (vectype),
+                                            scalar_value);
              vector_identity = gimple_build_vector_from_val (&seq, vectype,
                                                              scalar_value);
            }

Reply via email to