Commit 18fd43b9 by Richard Sandiford Committed by Richard Sandiford

Fix ICE in get_initial_defs_for_reduction (PR 88567)

The use of "j" in:

	      init = permute_results[number_of_vectors - j - 1];

was out-of-sync with the new flat loop structure.  Now that all that
reversing is gone, we can just use the result of duplicate_and_interleave
directly.

The other cases shouldn't be affected by postponing the insertion
of ctor_seq, since gimple_build* appends to the seq without clearing
it first (unlike some of the gimplify routines).

The ICE is already covered by gcc.dg/vect/pr63379.c.

2019-01-07  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	PR middle-end/88567
	* tree-vect-loop.c (get_initial_defs_for_reduction): Pass the
	output vector directly to duplicate_and_interleave instead of
	going through a temporary.  Postpone insertion of ctor_seq to
	the end of the loop.

From-SVN: r267652
parent e002afaa
2019-01-07 Richard Sandiford <richard.sandiford@arm.com>
PR middle-end/88567
* tree-vect-loop.c (get_initial_defs_for_reduction): Pass the
output vector directly to duplicate_and_interleave instead of
going through a temporary. Postpone insertion of ctor_seq to
the end of the loop.
2019-01-07 Richard Earnshaw <rearnsha@arm.com> 2019-01-07 Richard Earnshaw <rearnsha@arm.com>
PR target/86891 PR target/86891
......
...@@ -4103,7 +4103,6 @@ get_initial_defs_for_reduction (slp_tree slp_node, ...@@ -4103,7 +4103,6 @@ get_initial_defs_for_reduction (slp_tree slp_node,
unsigned int group_size = stmts.length (); unsigned int group_size = stmts.length ();
unsigned int i; unsigned int i;
struct loop *loop; struct loop *loop;
auto_vec<tree, 16> permute_results;
vector_type = STMT_VINFO_VECTYPE (stmt_vinfo); vector_type = STMT_VINFO_VECTYPE (stmt_vinfo);
...@@ -4138,6 +4137,7 @@ get_initial_defs_for_reduction (slp_tree slp_node, ...@@ -4138,6 +4137,7 @@ get_initial_defs_for_reduction (slp_tree slp_node,
bool constant_p = true; bool constant_p = true;
tree_vector_builder elts (vector_type, nunits, 1); tree_vector_builder elts (vector_type, nunits, 1);
elts.quick_grow (nunits); elts.quick_grow (nunits);
gimple_seq ctor_seq = NULL;
for (j = 0; j < nunits * number_of_vectors; ++j) for (j = 0; j < nunits * number_of_vectors; ++j)
{ {
tree op; tree op;
...@@ -4163,7 +4163,6 @@ get_initial_defs_for_reduction (slp_tree slp_node, ...@@ -4163,7 +4163,6 @@ get_initial_defs_for_reduction (slp_tree slp_node,
if (number_of_places_left_in_vector == 0) if (number_of_places_left_in_vector == 0)
{ {
gimple_seq ctor_seq = NULL;
tree init; tree init;
if (constant_p && !neutral_op if (constant_p && !neutral_op
? multiple_p (TYPE_VECTOR_SUBPARTS (vector_type), nunits) ? multiple_p (TYPE_VECTOR_SUBPARTS (vector_type), nunits)
...@@ -4189,16 +4188,11 @@ get_initial_defs_for_reduction (slp_tree slp_node, ...@@ -4189,16 +4188,11 @@ get_initial_defs_for_reduction (slp_tree slp_node,
else else
{ {
/* First time round, duplicate ELTS to fill the /* First time round, duplicate ELTS to fill the
required number of vectors, then cherry pick the required number of vectors. */
appropriate result for each iteration. */ duplicate_and_interleave (&ctor_seq, vector_type, elts,
if (vec_oprnds->is_empty ()) number_of_vectors, *vec_oprnds);
duplicate_and_interleave (&ctor_seq, vector_type, elts, break;
number_of_vectors,
permute_results);
init = permute_results[number_of_vectors - j - 1];
} }
if (ctor_seq != NULL)
gsi_insert_seq_on_edge_immediate (pe, ctor_seq);
vec_oprnds->quick_push (init); vec_oprnds->quick_push (init);
number_of_places_left_in_vector = nunits; number_of_places_left_in_vector = nunits;
...@@ -4207,6 +4201,8 @@ get_initial_defs_for_reduction (slp_tree slp_node, ...@@ -4207,6 +4201,8 @@ get_initial_defs_for_reduction (slp_tree slp_node,
constant_p = true; constant_p = true;
} }
} }
if (ctor_seq != NULL)
gsi_insert_seq_on_edge_immediate (pe, ctor_seq);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment