When the neutral op is the initial value we might need to convert
it from pointer to integer.
Bootstrapped and tested no x86_64-unknown-linux-gnu, pushed.
This shows with the SLP single-lane reduction discovery.
* tree-vect-loop.cc (get_initial_defs_for_reduction): Convert
neutral op to the vector component type.
---
gcc/tree-vect-loop.cc | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 31abfe047a4..24a1239f016 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -5616,7 +5616,14 @@ get_initial_defs_for_reduction (loop_vec_info loop_vinfo,
/* Get the def before the loop. In reduction chain we have only
one initial value. Else we have as many as PHIs in the group. */
if (i >= initial_values.length () || (j > i && neutral_op))
- op = neutral_op;
+ {
+ if (!useless_type_conversion_p (TREE_TYPE (vector_type),
+ TREE_TYPE (neutral_op)))
+ neutral_op = gimple_convert (&ctor_seq,
+ TREE_TYPE (vector_type),
+ neutral_op);
+ op = neutral_op;
+ }
else
{
if (!useless_type_conversion_p (TREE_TYPE (vector_type),
--
2.35.3