tree-optimization/101003 - use pattern defs when linearizing

Message ID 1q3s9r9r-r6qn-5o55-23s-9q14op1rnqqo@fhfr.qr
State New
Headers show
Series
  • tree-optimization/101003 - use pattern defs when linearizing
Related show

Commit Message

Richard Biener June 10, 2021, 8:41 a.m.
We of course have to use pattern stmt defs for the linearized
chain operands which is what I failed to ensure.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

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

	PR tree-optimization/101003
	* tree-vect-slp.c (vect_build_slp_tree_2): Appropriately
	use the pattern stmt defs when linearizing a chain.
---
 gcc/tree-vect-slp.c | 5 +++++
 1 file changed, 5 insertions(+)

-- 
2.26.2

Patch

diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index 1915d74070b..c4f8f38012f 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -1806,6 +1806,11 @@  vect_build_slp_tree_2 (vec_info *vinfo, slp_tree node,
 		  stmt_vec_info def_stmt_info;
 		  bool res = vect_is_simple_use (op, vinfo, &dt, &def_stmt_info);
 		  gcc_assert (res);
+		  if (dt == vect_internal_def)
+		    {
+		      def_stmt_info = vect_stmt_to_vectorize (def_stmt_info);
+		      op = gimple_get_lhs (def_stmt_info->stmt);
+		    }
 		  gimple *use_stmt;
 		  use_operand_p use_p;
 		  if (dt == vect_internal_def