for (unsigned i = 0; i < vec_num; i++)
{
if (slp_node)
- def = gimple_get_lhs (SLP_TREE_VEC_STMTS (slp_node)[i]->stmt);
+ def = vect_get_slp_vect_def (slp_node, i);
else
def = gimple_get_lhs (STMT_VINFO_VEC_STMT (rdef_info)->stmt);
for (j = 0; j < ncopies; j++)
SLP_TREE_VEC_DEFS (op_node).quick_push (vop);
}
+/* Get the Ith vectorized definition from SLP_NODE. */
-/* Get vectorized definitions from SLP_NODE that contains corresponding
- vectorized def-stmts. */
-
-static void
-vect_get_slp_vect_defs (slp_tree slp_node, vec<tree> *vec_oprnds)
+tree
+vect_get_slp_vect_def (slp_tree slp_node, unsigned i)
{
- stmt_vec_info vec_def_stmt_info;
- unsigned int i;
-
- gcc_assert (SLP_TREE_VEC_STMTS (slp_node).exists ());
-
- FOR_EACH_VEC_ELT (SLP_TREE_VEC_STMTS (slp_node), i, vec_def_stmt_info)
- vec_oprnds->quick_push (gimple_get_lhs (vec_def_stmt_info->stmt));
+ if (SLP_TREE_VEC_STMTS (slp_node).exists ())
+ return gimple_get_lhs (SLP_TREE_VEC_STMTS (slp_node)[i]->stmt);
+ else
+ return SLP_TREE_VEC_DEFS (slp_node)[i];
}
-
/* Get N vectorized definitions for SLP_NODE. */
void
node or we need to create them (for invariants and constants). */
vec_defs.create (SLP_TREE_NUMBER_OF_VEC_STMTS (child));
if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
- vect_get_slp_vect_defs (child, &vec_defs);
+ {
+ unsigned j;
+ stmt_vec_info vec_def_stmt_info;
+ FOR_EACH_VEC_ELT (SLP_TREE_VEC_STMTS (child), j, vec_def_stmt_info)
+ vec_defs.quick_push (gimple_get_lhs (vec_def_stmt_info->stmt));
+ }
else
vec_defs.splice (SLP_TREE_VEC_DEFS (child));
== SLP_TREE_VEC_STMTS (slp_node).length ());
for (unsigned i = 0; i < SLP_TREE_VEC_STMTS (phi_node).length (); ++i)
add_phi_arg (as_a <gphi *> (SLP_TREE_VEC_STMTS (phi_node)[i]->stmt),
- gimple_get_lhs (SLP_TREE_VEC_STMTS (slp_node)[i]->stmt),
+ vect_get_slp_vect_def (slp_node, i),
e, gimple_phi_arg_location (phi, e->dest_idx));
}
}
slp_tree child = SLP_TREE_CHILDREN (slp_node)[operand];
*slp_def = child;
if (SLP_TREE_DEF_TYPE (child) == vect_internal_def)
- *op = gimple_get_lhs (SLP_TREE_SCALAR_STMTS (child)[0]->stmt);
+ *op = gimple_get_lhs (SLP_TREE_REPRESENTATIVE (child)->stmt);
else
{
if (def_stmt_info_out)
extern tree vect_init_vector (vec_info *, stmt_vec_info, tree, tree,
gimple_stmt_iterator *);
extern tree vect_get_vec_def_for_stmt_copy (vec_info *, tree);
+extern tree vect_get_slp_vect_def (slp_tree, unsigned);
extern bool vect_transform_stmt (vec_info *, stmt_vec_info,
gimple_stmt_iterator *,
slp_tree, slp_instance);