aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-slp.c
diff options
context:
space:
mode:
authorAlan Hayward <alan.hayward@arm.com>2016-08-17 15:31:44 +0000
committerAlan Hayward <alahay01@gcc.gnu.org>2016-08-17 15:31:44 +0000
commit038000bd9d2f2364ea39d352d916feb7101026e5 (patch)
tree7a69c7efc5236094c007afb91f4bcdb0b55b0494 /gcc/tree-vect-slp.c
parentdd42e908a081c76a0f0fee1af2ef53d9c4678672 (diff)
downloadgcc-038000bd9d2f2364ea39d352d916feb7101026e5.zip
gcc-038000bd9d2f2364ea39d352d916feb7101026e5.tar.gz
gcc-038000bd9d2f2364ea39d352d916feb7101026e5.tar.bz2
re PR tree-optimization/71752 (ICE in compute_live_loop_exits, at tree-ssa-loop-manip.c:229 w/ -O1 -ftree-vectorize)
2015-08-17 Alan Hayward <alan.hayward@arm.com> PR tree-optimization/71752 * tree-vect-loop.c (vectorizable_reduction): Keep SLP operand ordering. * tree-vect-slp.c (vect_get_slp_defs): Handle null operands. PR tree-optimization/71752 * gcc.dg/vect/pr71752.c: New From-SVN: r239542
Diffstat (limited to 'gcc/tree-vect-slp.c')
-rw-r--r--gcc/tree-vect-slp.c57
1 files changed, 31 insertions, 26 deletions
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index fb325d5..5a611e4 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -3194,24 +3194,32 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node,
{
gimple *first_stmt;
int number_of_vects = 0, i;
- unsigned int child_index = 0;
HOST_WIDE_INT lhs_size_unit, rhs_size_unit;
slp_tree child = NULL;
vec<tree> vec_defs;
tree oprnd;
- bool vectorized_defs;
+ bool first_iteration = true;
first_stmt = SLP_TREE_SCALAR_STMTS (slp_node)[0];
FOR_EACH_VEC_ELT (ops, i, oprnd)
{
+ bool vectorized_defs = false;
+
+ if (oprnd == NULL)
+ {
+ vec_defs = vNULL;
+ vec_defs.create (0);
+ vec_oprnds->quick_push (vec_defs);
+ continue;
+ }
+
/* For each operand we check if it has vectorized definitions in a child
node or we need to create them (for invariants and constants). We
check if the LHS of the first stmt of the next child matches OPRND.
If it does, we found the correct child. Otherwise, we call
- vect_get_constant_vectors (), and not advance CHILD_INDEX in order
- to check this child node for the next operand. */
- vectorized_defs = false;
- if (SLP_TREE_CHILDREN (slp_node).length () > child_index)
+ vect_get_constant_vectors (). */
+ for (unsigned int child_index = 0;
+ child_index < SLP_TREE_CHILDREN (slp_node).length (); child_index++)
{
child = SLP_TREE_CHILDREN (slp_node)[child_index];
@@ -3231,30 +3239,25 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node,
statements. */
number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (child);
vectorized_defs = true;
- child_index++;
+ break;
}
}
- else
- child_index++;
}
- if (!vectorized_defs)
- {
- if (i == 0)
- {
- number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
- /* Number of vector stmts was calculated according to LHS in
- vect_schedule_slp_instance (), fix it by replacing LHS with
- RHS, if necessary. See vect_get_smallest_scalar_type () for
- details. */
- vect_get_smallest_scalar_type (first_stmt, &lhs_size_unit,
- &rhs_size_unit);
- if (rhs_size_unit != lhs_size_unit)
- {
- number_of_vects *= rhs_size_unit;
- number_of_vects /= lhs_size_unit;
- }
- }
+ if (!vectorized_defs && first_iteration)
+ {
+ number_of_vects = SLP_TREE_NUMBER_OF_VEC_STMTS (slp_node);
+ /* Number of vector stmts was calculated according to LHS in
+ vect_schedule_slp_instance (), fix it by replacing LHS with
+ RHS, if necessary. See vect_get_smallest_scalar_type () for
+ details. */
+ vect_get_smallest_scalar_type (first_stmt, &lhs_size_unit,
+ &rhs_size_unit);
+ if (rhs_size_unit != lhs_size_unit)
+ {
+ number_of_vects *= rhs_size_unit;
+ number_of_vects /= lhs_size_unit;
+ }
}
/* Allocate memory for vectorized defs. */
@@ -3276,6 +3279,8 @@ vect_get_slp_defs (vec<tree> ops, slp_tree slp_node,
/* For reductions, we only need initial values. */
if (reduc_index != -1)
return;
+
+ first_iteration = false;
}
}