Commit 86a91c0a by Richard Sandiford Committed by Richard Sandiford

[28/46] Use stmt_vec_info instead of gimple stmts internally (part 1)

This first part makes functions use stmt_vec_infos instead of
gimple stmts in cases where the stmt_vec_info was already available
and where the change is mechanical.  Most of it is just replacing
"stmt" with "stmt_info".

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

gcc/
	* tree-vect-data-refs.c (vect_slp_analyze_node_dependences):
	(vect_check_gather_scatter, vect_create_data_ref_ptr, bump_vector_ptr)
	(vect_permute_store_chain, vect_setup_realignment)
	(vect_permute_load_chain, vect_shift_permute_load_chain)
	(vect_transform_grouped_load): Use stmt_vec_info rather than gimple
	stmts internally, and when passing values to other vectorizer routines.
	* tree-vect-loop-manip.c (vect_can_advance_ivs_p): Likewise.
	* tree-vect-loop.c (vect_analyze_scalar_cycles_1)
	(vect_analyze_loop_operations, get_initial_def_for_reduction)
	(vect_create_epilog_for_reduction, vectorize_fold_left_reduction)
	(vectorizable_reduction, vectorizable_induction)
	(vectorizable_live_operation, vect_transform_loop_stmt)
	(vect_transform_loop): Likewise.
	* tree-vect-patterns.c (vect_reassociating_reduction_p)
	(vect_recog_widen_op_pattern, vect_recog_mixed_size_cond_pattern)
	(vect_recog_bool_pattern, vect_recog_gather_scatter_pattern): Likewise.
	* tree-vect-slp.c (vect_analyze_slp_instance): Likewise.
	(vect_slp_analyze_node_operations_1): Likewise.
	* tree-vect-stmts.c (vect_mark_relevant, process_use)
	(exist_non_indexing_operands_for_use_p, vect_init_vector_1)
	(vect_mark_stmts_to_be_vectorized, vect_get_vec_def_for_operand)
	(vect_finish_stmt_generation_1, get_group_load_store_type)
	(get_load_store_type, vect_build_gather_load_calls)
	(vectorizable_bswap, vectorizable_call, vectorizable_simd_clone_call)
	(vect_create_vectorized_demotion_stmts, vectorizable_conversion)
	(vectorizable_assignment, vectorizable_shift, vectorizable_operation)
	(vectorizable_store, vectorizable_load, vectorizable_condition)
	(vectorizable_comparison, vect_analyze_stmt, vect_transform_stmt)
	(supportable_widening_operation): Likewise.
	(vect_get_vector_types_for_stmt): Likewise.
	* tree-vectorizer.h (vect_dr_behavior): Likewise.

From-SVN: r263143
parent 91987857
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vect-data-refs.c (vect_slp_analyze_node_dependences):
(vect_check_gather_scatter, vect_create_data_ref_ptr, bump_vector_ptr)
(vect_permute_store_chain, vect_setup_realignment)
(vect_permute_load_chain, vect_shift_permute_load_chain)
(vect_transform_grouped_load): Use stmt_vec_info rather than gimple
stmts internally, and when passing values to other vectorizer routines.
* tree-vect-loop-manip.c (vect_can_advance_ivs_p): Likewise.
* tree-vect-loop.c (vect_analyze_scalar_cycles_1)
(vect_analyze_loop_operations, get_initial_def_for_reduction)
(vect_create_epilog_for_reduction, vectorize_fold_left_reduction)
(vectorizable_reduction, vectorizable_induction)
(vectorizable_live_operation, vect_transform_loop_stmt)
(vect_transform_loop): Likewise.
* tree-vect-patterns.c (vect_reassociating_reduction_p)
(vect_recog_widen_op_pattern, vect_recog_mixed_size_cond_pattern)
(vect_recog_bool_pattern, vect_recog_gather_scatter_pattern): Likewise.
* tree-vect-slp.c (vect_analyze_slp_instance): Likewise.
(vect_slp_analyze_node_operations_1): Likewise.
* tree-vect-stmts.c (vect_mark_relevant, process_use)
(exist_non_indexing_operands_for_use_p, vect_init_vector_1)
(vect_mark_stmts_to_be_vectorized, vect_get_vec_def_for_operand)
(vect_finish_stmt_generation_1, get_group_load_store_type)
(get_load_store_type, vect_build_gather_load_calls)
(vectorizable_bswap, vectorizable_call, vectorizable_simd_clone_call)
(vect_create_vectorized_demotion_stmts, vectorizable_conversion)
(vectorizable_assignment, vectorizable_shift, vectorizable_operation)
(vectorizable_store, vectorizable_load, vectorizable_condition)
(vectorizable_comparison, vect_analyze_stmt, vect_transform_stmt)
(supportable_widening_operation): Likewise.
(vect_get_vector_types_for_stmt): Likewise.
* tree-vectorizer.h (vect_dr_behavior): Likewise.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vect-data-refs.c (vect_analyze_data_ref_dependence)
(vect_slp_analyze_node_dependences, vect_analyze_data_ref_accesses)
(vect_permute_store_chain, vect_permute_load_chain)
......
......@@ -1380,8 +1380,8 @@ vect_can_advance_ivs_p (loop_vec_info loop_vinfo)
stmt_vec_info phi_info = loop_vinfo->lookup_stmt (phi);
if (dump_enabled_p ())
{
dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi, 0);
dump_printf_loc (MSG_NOTE, vect_location, "Analyze phi: ");
dump_gimple_stmt (MSG_NOTE, TDF_SLIM, phi_info->stmt, 0);
}
/* Skip virtual phi's. The data dependences that are associated with
......
......@@ -842,7 +842,7 @@ vect_reassociating_reduction_p (stmt_vec_info stmt_info, tree_code code,
/* We don't allow changing the order of the computation in the inner-loop
when doing outer-loop vectorization. */
struct loop *loop = LOOP_VINFO_LOOP (loop_info);
if (loop && nested_in_vect_loop_p (loop, assign))
if (loop && nested_in_vect_loop_p (loop, stmt_info))
return false;
if (!vect_reassociating_reduction_p (stmt_info))
......@@ -1196,7 +1196,7 @@ vect_recog_widen_op_pattern (stmt_vec_info last_stmt_info, tree *type_out,
auto_vec<tree> dummy_vec;
if (!vectype
|| !vecitype
|| !supportable_widening_operation (wide_code, last_stmt,
|| !supportable_widening_operation (wide_code, last_stmt_info,
vecitype, vectype,
&dummy_code, &dummy_code,
&dummy_int, &dummy_vec))
......@@ -3118,11 +3118,11 @@ vect_recog_mixed_size_cond_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
return NULL;
if ((TREE_CODE (then_clause) != INTEGER_CST
&& !type_conversion_p (then_clause, last_stmt, false, &orig_type0,
&def_stmt0, &promotion))
&& !type_conversion_p (then_clause, stmt_vinfo, false, &orig_type0,
&def_stmt0, &promotion))
|| (TREE_CODE (else_clause) != INTEGER_CST
&& !type_conversion_p (else_clause, last_stmt, false, &orig_type1,
&def_stmt1, &promotion)))
&& !type_conversion_p (else_clause, stmt_vinfo, false, &orig_type1,
&def_stmt1, &promotion)))
return NULL;
if (orig_type0 && orig_type1
......@@ -3709,7 +3709,7 @@ vect_recog_bool_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
if (check_bool_pattern (var, vinfo, bool_stmts))
{
rhs = adjust_bool_stmts (bool_stmts, TREE_TYPE (lhs), last_stmt);
rhs = adjust_bool_stmts (bool_stmts, TREE_TYPE (lhs), stmt_vinfo);
lhs = vect_recog_temp_ssa_var (TREE_TYPE (lhs), NULL);
if (useless_type_conversion_p (TREE_TYPE (lhs), TREE_TYPE (rhs)))
pattern_stmt = gimple_build_assign (lhs, SSA_NAME, rhs);
......@@ -3776,7 +3776,7 @@ vect_recog_bool_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
if (!check_bool_pattern (var, vinfo, bool_stmts))
return NULL;
rhs = adjust_bool_stmts (bool_stmts, type, last_stmt);
rhs = adjust_bool_stmts (bool_stmts, type, stmt_vinfo);
lhs = vect_recog_temp_ssa_var (TREE_TYPE (lhs), NULL);
pattern_stmt
......@@ -3800,7 +3800,7 @@ vect_recog_bool_pattern (stmt_vec_info stmt_vinfo, tree *type_out)
return NULL;
if (check_bool_pattern (var, vinfo, bool_stmts))
rhs = adjust_bool_stmts (bool_stmts, TREE_TYPE (vectype), last_stmt);
rhs = adjust_bool_stmts (bool_stmts, TREE_TYPE (vectype), stmt_vinfo);
else
{
tree type = search_type_for_mask (var, vinfo);
......@@ -4234,13 +4234,12 @@ vect_recog_gather_scatter_pattern (stmt_vec_info stmt_info, tree *type_out)
/* Get the boolean that controls whether the load or store happens.
This is null if the operation is unconditional. */
gimple *stmt = stmt_info->stmt;
tree mask = vect_get_load_store_mask (stmt);
tree mask = vect_get_load_store_mask (stmt_info);
/* Make sure that the target supports an appropriate internal
function for the gather/scatter operation. */
gather_scatter_info gs_info;
if (!vect_check_gather_scatter (stmt, loop_vinfo, &gs_info)
if (!vect_check_gather_scatter (stmt_info, loop_vinfo, &gs_info)
|| gs_info.decl)
return NULL;
......@@ -4273,7 +4272,7 @@ vect_recog_gather_scatter_pattern (stmt_vec_info stmt_info, tree *type_out)
}
else
{
tree rhs = vect_get_store_rhs (stmt);
tree rhs = vect_get_store_rhs (stmt_info);
if (mask != NULL)
pattern_stmt = gimple_build_call_internal (IFN_MASK_SCATTER_STORE, 5,
base, offset, scale, rhs,
......@@ -4295,7 +4294,7 @@ vect_recog_gather_scatter_pattern (stmt_vec_info stmt_info, tree *type_out)
tree vectype = STMT_VINFO_VECTYPE (stmt_info);
*type_out = vectype;
vect_pattern_detected ("gather/scatter pattern", stmt);
vect_pattern_detected ("gather/scatter pattern", stmt_info->stmt);
return pattern_stmt;
}
......
......@@ -2096,8 +2096,8 @@ vect_analyze_slp_instance (vec_info *vinfo,
dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
"Build SLP failed: unsupported load "
"permutation ");
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION,
TDF_SLIM, stmt, 0);
dump_gimple_stmt (MSG_MISSED_OPTIMIZATION,
TDF_SLIM, stmt_info->stmt, 0);
}
vect_free_slp_instance (new_instance, false);
return false;
......@@ -2172,8 +2172,9 @@ vect_analyze_slp_instance (vec_info *vinfo,
gcc_assert ((const_nunits & (const_nunits - 1)) == 0);
unsigned group1_size = i & ~(const_nunits - 1);
gimple *rest = vect_split_slp_store_group (stmt, group1_size);
bool res = vect_analyze_slp_instance (vinfo, stmt, max_tree_size);
gimple *rest = vect_split_slp_store_group (stmt_info, group1_size);
bool res = vect_analyze_slp_instance (vinfo, stmt_info,
max_tree_size);
/* If the first non-match was in the middle of a vector,
skip the rest of that vector. */
if (group1_size < i)
......@@ -2513,7 +2514,6 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
stmt_vector_for_cost *cost_vec)
{
stmt_vec_info stmt_info = SLP_TREE_SCALAR_STMTS (node)[0];
gimple *stmt = stmt_info->stmt;
gcc_assert (STMT_SLP_TYPE (stmt_info) != loop_vect);
/* For BB vectorization vector types are assigned here.
......@@ -2567,7 +2567,7 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node,
}
bool dummy;
return vect_analyze_stmt (stmt, &dummy, node, node_instance, cost_vec);
return vect_analyze_stmt (stmt_info, &dummy, node, node_instance, cost_vec);
}
/* Analyze statements contained in SLP tree NODE after recursively analyzing
......
......@@ -1325,7 +1325,7 @@ vect_dr_behavior (data_reference *dr)
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info);
if (loop_vinfo == NULL
|| !nested_in_vect_loop_p (LOOP_VINFO_LOOP (loop_vinfo), stmt))
|| !nested_in_vect_loop_p (LOOP_VINFO_LOOP (loop_vinfo), stmt_info))
return &DR_INNERMOST (dr);
else
return &STMT_VINFO_DR_WRT_VEC_LOOP (stmt_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