Commit e4057a39 by Richard Sandiford Committed by Richard Sandiford

[34/46] Alter interface to vect_get_vec_def_for_stmt_copy

This patch makes vect_get_vec_def_for_stmt_copy take a vec_info
rather than a vect_def_type.  If the vector operand passed in is
defined in the vectorised region, we should look for copies in
the normal way.  If it's defined in an external statement
(such as by vect_init_vector_1) we should just use the original value.

2018-07-31  Richard Sandiford  <richard.sandiford@arm.com>

gcc/
	* tree-vectorizer.h (vect_get_vec_defs_for_stmt_copy)
	(vect_get_vec_def_for_stmt_copy): Take a vec_info rather than
	a vect_def_type for the first argument.
	* tree-vect-stmts.c (vect_get_vec_defs_for_stmt_copy): Likewise.
	(vect_get_vec_def_for_stmt_copy): Likewise.  Return the original
	operand if it isn't defined by a vectorized statement.
	(vect_build_gather_load_calls): Remove the mask_dt argument and
	update calls to vect_get_vec_def_for_stmt_copy.
	(vectorizable_bswap): Likewise the dt argument.
	(vectorizable_call): Update calls to vectorizable_bswap and
	vect_get_vec_def_for_stmt_copy.
	(vectorizable_simd_clone_call, vectorizable_assignment)
	(vectorizable_shift, vectorizable_operation, vectorizable_condition)
	(vectorizable_comparison): Update calls to
	vect_get_vec_def_for_stmt_copy.
	(vectorizable_store): Likewise.  Remove now-unnecessary calls to
	vect_is_simple_use.
	(vect_get_loop_based_defs): Remove dt argument and update call
	to vect_get_vec_def_for_stmt_copy.
	(vectorizable_conversion): Update calls to vect_get_loop_based_defs
	and vect_get_vec_def_for_stmt_copy.
	(vectorizable_load): Update calls to vect_build_gather_load_calls
	and vect_get_vec_def_for_stmt_copy.
	* tree-vect-loop.c (vect_create_epilog_for_reduction)
	(vectorizable_reduction, vectorizable_live_operation): Update calls
	to vect_get_vec_def_for_stmt_copy.

From-SVN: r263149
parent d7609678
2018-07-31 Richard Sandiford <richard.sandiford@arm.com> 2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (vect_get_vec_defs_for_stmt_copy)
(vect_get_vec_def_for_stmt_copy): Take a vec_info rather than
a vect_def_type for the first argument.
* tree-vect-stmts.c (vect_get_vec_defs_for_stmt_copy): Likewise.
(vect_get_vec_def_for_stmt_copy): Likewise. Return the original
operand if it isn't defined by a vectorized statement.
(vect_build_gather_load_calls): Remove the mask_dt argument and
update calls to vect_get_vec_def_for_stmt_copy.
(vectorizable_bswap): Likewise the dt argument.
(vectorizable_call): Update calls to vectorizable_bswap and
vect_get_vec_def_for_stmt_copy.
(vectorizable_simd_clone_call, vectorizable_assignment)
(vectorizable_shift, vectorizable_operation, vectorizable_condition)
(vectorizable_comparison): Update calls to
vect_get_vec_def_for_stmt_copy.
(vectorizable_store): Likewise. Remove now-unnecessary calls to
vect_is_simple_use.
(vect_get_loop_based_defs): Remove dt argument and update call
to vect_get_vec_def_for_stmt_copy.
(vectorizable_conversion): Update calls to vect_get_loop_based_defs
and vect_get_vec_def_for_stmt_copy.
(vectorizable_load): Update calls to vect_build_gather_load_calls
and vect_get_vec_def_for_stmt_copy.
* tree-vect-loop.c (vect_create_epilog_for_reduction)
(vectorizable_reduction, vectorizable_live_operation): Update calls
to vect_get_vec_def_for_stmt_copy.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vect-data-refs.c (vect_record_base_alignment): Replace vec_info * tree-vect-data-refs.c (vect_record_base_alignment): Replace vec_info
and gimple stmt arguments with a stmt_vec_info. and gimple stmt arguments with a stmt_vec_info.
(vect_record_base_alignments): Update calls accordingly. (vect_record_base_alignments): Update calls accordingly.
......
...@@ -4421,7 +4421,6 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, ...@@ -4421,7 +4421,6 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs,
bool nested_in_vect_loop = false; bool nested_in_vect_loop = false;
auto_vec<gimple *> new_phis; auto_vec<gimple *> new_phis;
auto_vec<stmt_vec_info> inner_phis; auto_vec<stmt_vec_info> inner_phis;
enum vect_def_type dt = vect_unknown_def_type;
int j, i; int j, i;
auto_vec<tree> scalar_results; auto_vec<tree> scalar_results;
unsigned int group_size = 1, k, ratio; unsigned int group_size = 1, k, ratio;
...@@ -4528,8 +4527,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, ...@@ -4528,8 +4527,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs,
phi_info = STMT_VINFO_RELATED_STMT (phi_info); phi_info = STMT_VINFO_RELATED_STMT (phi_info);
if (nested_in_vect_loop) if (nested_in_vect_loop)
vec_init_def vec_init_def
= vect_get_vec_def_for_stmt_copy (initial_def_dt, = vect_get_vec_def_for_stmt_copy (loop_vinfo, vec_init_def);
vec_init_def);
} }
/* Set the loop-entry arg of the reduction-phi. */ /* Set the loop-entry arg of the reduction-phi. */
...@@ -4556,7 +4554,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, ...@@ -4556,7 +4554,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs,
/* Set the loop-latch arg for the reduction-phi. */ /* Set the loop-latch arg for the reduction-phi. */
if (j > 0) if (j > 0)
def = vect_get_vec_def_for_stmt_copy (vect_unknown_def_type, def); def = vect_get_vec_def_for_stmt_copy (loop_vinfo, def);
add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION); add_phi_arg (phi, def, loop_latch_edge (loop), UNKNOWN_LOCATION);
...@@ -4697,7 +4695,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, ...@@ -4697,7 +4695,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs,
new_phis.quick_push (phi); new_phis.quick_push (phi);
else else
{ {
def = vect_get_vec_def_for_stmt_copy (dt, def); def = vect_get_vec_def_for_stmt_copy (loop_vinfo, def);
STMT_VINFO_RELATED_STMT (prev_phi_info) = phi_info; STMT_VINFO_RELATED_STMT (prev_phi_info) = phi_info;
} }
...@@ -7111,19 +7109,22 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, ...@@ -7111,19 +7109,22 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
vec_oprnds0[0] = gimple_get_lhs (new_stmt_info->stmt); vec_oprnds0[0] = gimple_get_lhs (new_stmt_info->stmt);
else else
vec_oprnds0[0] vec_oprnds0[0]
= vect_get_vec_def_for_stmt_copy (dts[0], vec_oprnds0[0]); = vect_get_vec_def_for_stmt_copy (loop_vinfo,
vec_oprnds0[0]);
if (single_defuse_cycle && reduc_index == 1) if (single_defuse_cycle && reduc_index == 1)
vec_oprnds1[0] = gimple_get_lhs (new_stmt_info->stmt); vec_oprnds1[0] = gimple_get_lhs (new_stmt_info->stmt);
else else
vec_oprnds1[0] vec_oprnds1[0]
= vect_get_vec_def_for_stmt_copy (dts[1], vec_oprnds1[0]); = vect_get_vec_def_for_stmt_copy (loop_vinfo,
vec_oprnds1[0]);
if (op_type == ternary_op) if (op_type == ternary_op)
{ {
if (single_defuse_cycle && reduc_index == 2) if (single_defuse_cycle && reduc_index == 2)
vec_oprnds2[0] = gimple_get_lhs (new_stmt_info->stmt); vec_oprnds2[0] = gimple_get_lhs (new_stmt_info->stmt);
else else
vec_oprnds2[0] vec_oprnds2[0]
= vect_get_vec_def_for_stmt_copy (dts[2], vec_oprnds2[0]); = vect_get_vec_def_for_stmt_copy (loop_vinfo,
vec_oprnds2[0]);
} }
} }
} }
...@@ -7945,8 +7946,7 @@ vectorizable_live_operation (stmt_vec_info stmt_info, ...@@ -7945,8 +7946,7 @@ vectorizable_live_operation (stmt_vec_info stmt_info,
/* For multiple copies, get the last copy. */ /* For multiple copies, get the last copy. */
for (int i = 1; i < ncopies; ++i) for (int i = 1; i < ncopies; ++i)
vec_lhs = vect_get_vec_def_for_stmt_copy (vect_unknown_def_type, vec_lhs = vect_get_vec_def_for_stmt_copy (loop_vinfo, vec_lhs);
vec_lhs);
/* Get the last lane in the vector. */ /* Get the last lane in the vector. */
bitstart = int_const_binop (MINUS_EXPR, vec_bitsize, bitsize); bitstart = int_const_binop (MINUS_EXPR, vec_bitsize, bitsize);
......
...@@ -1514,11 +1514,11 @@ extern tree vect_get_vec_def_for_operand_1 (stmt_vec_info, enum vect_def_type); ...@@ -1514,11 +1514,11 @@ extern tree vect_get_vec_def_for_operand_1 (stmt_vec_info, enum vect_def_type);
extern tree vect_get_vec_def_for_operand (tree, stmt_vec_info, tree = NULL); extern tree vect_get_vec_def_for_operand (tree, stmt_vec_info, tree = NULL);
extern void vect_get_vec_defs (tree, tree, stmt_vec_info, vec<tree> *, extern void vect_get_vec_defs (tree, tree, stmt_vec_info, vec<tree> *,
vec<tree> *, slp_tree); vec<tree> *, slp_tree);
extern void vect_get_vec_defs_for_stmt_copy (enum vect_def_type *, extern void vect_get_vec_defs_for_stmt_copy (vec_info *,
vec<tree> *, vec<tree> *); vec<tree> *, vec<tree> *);
extern tree vect_init_vector (stmt_vec_info, tree, tree, extern tree vect_init_vector (stmt_vec_info, tree, tree,
gimple_stmt_iterator *); gimple_stmt_iterator *);
extern tree vect_get_vec_def_for_stmt_copy (enum vect_def_type, tree); extern tree vect_get_vec_def_for_stmt_copy (vec_info *, tree);
extern bool vect_transform_stmt (stmt_vec_info, gimple_stmt_iterator *, extern bool vect_transform_stmt (stmt_vec_info, gimple_stmt_iterator *,
bool *, slp_tree, slp_instance); bool *, slp_tree, slp_instance);
extern void vect_remove_stores (stmt_vec_info); extern void vect_remove_stores (stmt_vec_info);
......
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