Use SLP_TREE_VECTYPE consistently
This assigns SLP_TREE_VECTYPE to all SLP nodes and uses it when analyzing def operands. It does not deal with mismatches between SLP_TREE_VECTYPE and STMT_VINFO_VECTYPE yet - those cases are still rejected until I get to clean up the interaction with data reference groups. 2020-06-17 Richard Biener <rguenther@suse.de> * tree-vect-slp.c (vect_build_slp_tree_1): Set the passed in *vectype parameter. (vect_build_slp_tree_2): Set SLP_TREE_VECTYPE from what vect_build_slp_tree_1 computed. (vect_analyze_slp_instance): Set SLP_TREE_VECTYPE. (vect_slp_analyze_node_operations_1): Use the SLP node vector type. (vect_schedule_slp_instance): Likewise. * tree-vect-stmts.c (vect_is_simple_use): Take the vector type from SLP_TREE_VECTYPE.
This commit is contained in:
parent
ae2ebf011f
commit
8a9e230f41
@ -744,7 +744,7 @@ static bool
|
|||||||
vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
|
vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
|
||||||
vec<stmt_vec_info> stmts, unsigned int group_size,
|
vec<stmt_vec_info> stmts, unsigned int group_size,
|
||||||
poly_uint64 *max_nunits, bool *matches,
|
poly_uint64 *max_nunits, bool *matches,
|
||||||
bool *two_operators)
|
bool *two_operators, tree *node_vectype)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
stmt_vec_info first_stmt_info = stmts[0];
|
stmt_vec_info first_stmt_info = stmts[0];
|
||||||
@ -848,6 +848,7 @@ vect_build_slp_tree_1 (vec_info *vinfo, unsigned char *swap,
|
|||||||
/* Check the operation. */
|
/* Check the operation. */
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
{
|
{
|
||||||
|
*node_vectype = vectype;
|
||||||
first_stmt_code = rhs_code;
|
first_stmt_code = rhs_code;
|
||||||
|
|
||||||
/* Shift arguments should be equal in all the packed stmts for a
|
/* Shift arguments should be equal in all the packed stmts for a
|
||||||
@ -1259,14 +1260,17 @@ vect_build_slp_tree_2 (vec_info *vinfo,
|
|||||||
return NULL;
|
return NULL;
|
||||||
(*tree_size)++;
|
(*tree_size)++;
|
||||||
node = vect_create_new_slp_node (stmts, 0);
|
node = vect_create_new_slp_node (stmts, 0);
|
||||||
|
SLP_TREE_VECTYPE (node) = vectype;
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool two_operators = false;
|
bool two_operators = false;
|
||||||
unsigned char *swap = XALLOCAVEC (unsigned char, group_size);
|
unsigned char *swap = XALLOCAVEC (unsigned char, group_size);
|
||||||
|
tree vectype = NULL_TREE;
|
||||||
if (!vect_build_slp_tree_1 (vinfo, swap, stmts, group_size,
|
if (!vect_build_slp_tree_1 (vinfo, swap, stmts, group_size,
|
||||||
&this_max_nunits, matches, &two_operators))
|
&this_max_nunits, matches, &two_operators,
|
||||||
|
&vectype))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* If the SLP node is a load, terminate the recursion unless masked. */
|
/* If the SLP node is a load, terminate the recursion unless masked. */
|
||||||
@ -1284,6 +1288,7 @@ vect_build_slp_tree_2 (vec_info *vinfo,
|
|||||||
*max_nunits = this_max_nunits;
|
*max_nunits = this_max_nunits;
|
||||||
(*tree_size)++;
|
(*tree_size)++;
|
||||||
node = vect_create_new_slp_node (stmts, 0);
|
node = vect_create_new_slp_node (stmts, 0);
|
||||||
|
SLP_TREE_VECTYPE (node) = vectype;
|
||||||
/* And compute the load permutation. Whether it is actually
|
/* And compute the load permutation. Whether it is actually
|
||||||
a permutation depends on the unrolling factor which is
|
a permutation depends on the unrolling factor which is
|
||||||
decided later. */
|
decided later. */
|
||||||
@ -1509,6 +1514,7 @@ fail:
|
|||||||
|
|
||||||
node = vect_create_new_slp_node (stmts, nops);
|
node = vect_create_new_slp_node (stmts, nops);
|
||||||
SLP_TREE_TWO_OPERATORS (node) = two_operators;
|
SLP_TREE_TWO_OPERATORS (node) = two_operators;
|
||||||
|
SLP_TREE_VECTYPE (node) = vectype;
|
||||||
SLP_TREE_CHILDREN (node).splice (children);
|
SLP_TREE_CHILDREN (node).splice (children);
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
@ -2169,6 +2175,7 @@ vect_analyze_slp_instance (vec_info *vinfo,
|
|||||||
for (unsigned i = 0; i < group_size; ++i)
|
for (unsigned i = 0; i < group_size; ++i)
|
||||||
scalar_stmts.quick_push (next_info);
|
scalar_stmts.quick_push (next_info);
|
||||||
slp_tree conv = vect_create_new_slp_node (scalar_stmts, 1);
|
slp_tree conv = vect_create_new_slp_node (scalar_stmts, 1);
|
||||||
|
SLP_TREE_VECTYPE (conv) = STMT_VINFO_VECTYPE (next_info);
|
||||||
SLP_TREE_CHILDREN (conv).quick_push (node);
|
SLP_TREE_CHILDREN (conv).quick_push (node);
|
||||||
SLP_INSTANCE_TREE (new_instance) = conv;
|
SLP_INSTANCE_TREE (new_instance) = conv;
|
||||||
/* We also have to fake this conversion stmt as SLP reduction
|
/* We also have to fake this conversion stmt as SLP reduction
|
||||||
@ -2620,7 +2627,7 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
|
|||||||
else
|
else
|
||||||
vf = 1;
|
vf = 1;
|
||||||
unsigned int group_size = SLP_TREE_LANES (node);
|
unsigned int group_size = SLP_TREE_LANES (node);
|
||||||
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
|
tree vectype = SLP_TREE_VECTYPE (node);
|
||||||
SLP_TREE_NUMBER_OF_VEC_STMTS (node)
|
SLP_TREE_NUMBER_OF_VEC_STMTS (node)
|
||||||
= vect_get_num_vectors (vf * group_size, vectype);
|
= vect_get_num_vectors (vf * group_size, vectype);
|
||||||
}
|
}
|
||||||
@ -3963,7 +3970,7 @@ vect_schedule_slp_instance (vec_info *vinfo,
|
|||||||
stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
|
stmt_vec_info stmt_info = SLP_TREE_REPRESENTATIVE (node);
|
||||||
|
|
||||||
/* VECTYPE is the type of the destination. */
|
/* VECTYPE is the type of the destination. */
|
||||||
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
|
tree vectype = SLP_TREE_VECTYPE (node);
|
||||||
poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype);
|
poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype);
|
||||||
unsigned group_size = SLP_TREE_SCALAR_STMTS (node).length ();
|
unsigned group_size = SLP_TREE_SCALAR_STMTS (node).length ();
|
||||||
|
|
||||||
|
@ -11230,15 +11230,18 @@ vect_is_simple_use (vec_info *vinfo, stmt_vec_info stmt, slp_tree slp_node,
|
|||||||
{
|
{
|
||||||
slp_tree child = SLP_TREE_CHILDREN (slp_node)[operand];
|
slp_tree child = SLP_TREE_CHILDREN (slp_node)[operand];
|
||||||
*slp_def = child;
|
*slp_def = child;
|
||||||
|
*vectype = SLP_TREE_VECTYPE (child);
|
||||||
if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
|
if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
|
||||||
*op = gimple_get_lhs (SLP_TREE_REPRESENTATIVE (child)->stmt);
|
{
|
||||||
|
*op = gimple_get_lhs (SLP_TREE_REPRESENTATIVE (child)->stmt);
|
||||||
|
return vect_is_simple_use (*op, vinfo, dt, def_stmt_info_out);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (def_stmt_info_out)
|
if (def_stmt_info_out)
|
||||||
*def_stmt_info_out = NULL;
|
*def_stmt_info_out = NULL;
|
||||||
*op = SLP_TREE_SCALAR_OPS (child)[0];
|
*op = SLP_TREE_SCALAR_OPS (child)[0];
|
||||||
*dt = SLP_TREE_DEF_TYPE (child);
|
*dt = SLP_TREE_DEF_TYPE (child);
|
||||||
*vectype = SLP_TREE_VECTYPE (child);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -11269,11 +11272,8 @@ vect_is_simple_use (vec_info *vinfo, stmt_vec_info stmt, slp_tree slp_node,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
gcc_unreachable ();
|
gcc_unreachable ();
|
||||||
|
return vect_is_simple_use (*op, vinfo, dt, vectype, def_stmt_info_out);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ??? We might want to update *vectype from *slp_def here though
|
|
||||||
when sharing nodes this would prevent unsharing in the caller. */
|
|
||||||
return vect_is_simple_use (*op, vinfo, dt, vectype, def_stmt_info_out);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If OP is not NULL and is external or constant update its vector
|
/* If OP is not NULL and is external or constant update its vector
|
||||||
|
Loading…
Reference in New Issue
Block a user