]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fixup reduction info on addsub SLP pattern
authorRichard Biener <rguenther@suse.de>
Fri, 25 Jun 2021 06:54:14 +0000 (08:54 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 25 Jun 2021 08:18:56 +0000 (10:18 +0200)
gcc.dg/vect/pr96854.c shows we need to copy over reduction info
to the SLP pattern as already done for the complex patterns.

2021-06-25  Richard Biener  <rguenther@suse.de>

* tree-vect-slp-patterns.c (addsub_pattern::build): Copy
STMT_VINFO_REDUC_DEF from the original representative.

gcc/tree-vect-slp-patterns.c

index d536494a1bd780b41b90f2d2e5b109144c96b1a0..2671f91972d790004e5ff37e60a86cd57d0c5611 100644 (file)
@@ -1577,11 +1577,13 @@ addsub_pattern::build (vec_info *vinfo)
                               (TREE_TYPE (gimple_assign_lhs (rep->stmt))));
   gimple_call_set_nothrow (call, true);
   gimple_set_bb (call, gimple_bb (rep->stmt));
-  SLP_TREE_REPRESENTATIVE (node) = vinfo->add_pattern_stmt (call, rep);
-  STMT_VINFO_RELEVANT (SLP_TREE_REPRESENTATIVE (node)) = vect_used_in_scope;
-  STMT_SLP_TYPE (SLP_TREE_REPRESENTATIVE (node)) = pure_slp;
-  STMT_VINFO_VECTYPE (SLP_TREE_REPRESENTATIVE (node)) = SLP_TREE_VECTYPE (node);
-  STMT_VINFO_SLP_VECT_ONLY_PATTERN (SLP_TREE_REPRESENTATIVE (node)) = true;
+  stmt_vec_info new_rep = vinfo->add_pattern_stmt (call, rep);
+  SLP_TREE_REPRESENTATIVE (node) = new_rep;
+  STMT_VINFO_RELEVANT (new_rep) = vect_used_in_scope;
+  STMT_SLP_TYPE (new_rep) = pure_slp;
+  STMT_VINFO_VECTYPE (new_rep) = SLP_TREE_VECTYPE (node);
+  STMT_VINFO_SLP_VECT_ONLY_PATTERN (new_rep) = true;
+  STMT_VINFO_REDUC_DEF (new_rep) = STMT_VINFO_REDUC_DEF (vect_orig_stmt (rep));
   SLP_TREE_CODE (node) = ERROR_MARK;
   SLP_TREE_LANE_PERMUTATION (node).release ();