diff options
author | Richard Biener <rguenther@suse.de> | 2024-05-27 11:38:11 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2024-05-28 10:15:29 +0200 |
commit | 65aa46ffc3b06bba3d49b9b8315610c706a1215b (patch) | |
tree | 741014c4f96cd530912bbc32ca412f264beda601 /gcc/tree-vect-loop.cc | |
parent | c65002347e595cda8b15e59e734d209283faf2b6 (diff) | |
download | gcc-65aa46ffc3b06bba3d49b9b8315610c706a1215b.zip gcc-65aa46ffc3b06bba3d49b9b8315610c706a1215b.tar.gz gcc-65aa46ffc3b06bba3d49b9b8315610c706a1215b.tar.bz2 |
Fix SLP reduction neutral op value for pointer reductions
When the neutral op is the initial value we might need to convert
it from pointer to integer.
* tree-vect-loop.cc (get_initial_defs_for_reduction): Convert
neutral op to the vector component type.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r-- | gcc/tree-vect-loop.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 83c0544..3b94bb1 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), |