]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix SLP reduction initial value for pointer reductions
authorRichard Biener <rguenther@suse.de>
Fri, 23 Feb 2024 10:21:20 +0000 (11:21 +0100)
committerRichard Biener <rguenther@suse.de>
Wed, 8 May 2024 12:30:39 +0000 (14:30 +0200)
For pointer reductions we need to convert the initial value to
the vector component integer type.

* tree-vect-loop.cc (get_initial_defs_for_reduction): Convert
initial value to the vector component type.

gcc/tree-vect-loop.cc

index 29c03c246d45bfce6329e0d4ea8f5612d9285484..704df7bdcc7366abb083d97f51067ecbcaa78fe9 100644 (file)
@@ -5618,7 +5618,14 @@ get_initial_defs_for_reduction (loop_vec_info loop_vinfo,
       if (i >= initial_values.length () || (j > i && neutral_op))
        op = neutral_op;
       else
-       op = initial_values[i];
+       {
+         if (!useless_type_conversion_p (TREE_TYPE (vector_type),
+                                         TREE_TYPE (initial_values[i])))
+           initial_values[i] = gimple_convert (&ctor_seq,
+                                               TREE_TYPE (vector_type),
+                                               initial_values[i]);
+         op = initial_values[i];
+       }
 
       /* Create 'vect_ = {op0,op1,...,opn}'.  */
       number_of_places_left_in_vector--;