Add missing conversion in vect_create_epilog_for_reduction
authorRichard Sandiford <richard.sandiford@arm.com>
Tue, 10 Dec 2019 12:20:12 +0000 (12:20 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Tue, 10 Dec 2019 12:20:12 +0000 (12:20 +0000)
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.

2019-12-10  Richard Sandiford  <richard.sandiford@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.

From-SVN: r279164

gcc/ChangeLog
gcc/tree-vect-loop.c

index 0ca3e15f4c9f41461bf05c65991150d114d7cc34..ffc2d26d6fbfd6e34b441360b59cf53592ab3c33 100644 (file)
@@ -1,3 +1,9 @@
+2019-12-10  Richard Sandiford  <richard.sandiford@arm.com>
+
+       * 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.
+
 2019-12-10  Richard Sandiford  <richard.sandiford@arm.com>
 
        * tree-vect-stmts.c (vectorizable_condition): Record the loop
index 50f1a227d4e9174f66cb970700d5c31965fe3f06..353a5ff06e14d21d15cb98fc2b5a654072dc5b4f 100644 (file)
@@ -5054,6 +5054,8 @@ vect_create_epilog_for_reduction (stmt_vec_info stmt_info,
              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);
            }