Commit f5ae2856 by Richard Sandiford Committed by Richard Sandiford

[40/46] Add vec_info::lookup_dr

This patch replaces DR_VECT_AUX and vect_dr_stmt with a new
vec_info::lookup_dr function, so that the lookup is relative
to a particular vec_info rather than to global state.

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

gcc/
	* tree-vectorizer.h (vec_info::lookup_dr): New member function.
	(vect_dr_stmt): Delete.
	* tree-vectorizer.c (vec_info::lookup_dr): New function.
	* tree-vect-loop-manip.c (vect_update_inits_of_drs): Use it instead
	of DR_VECT_AUX.
	* tree-vect-data-refs.c (vect_analyze_possibly_independent_ddr)
	(vect_analyze_data_ref_dependence, vect_record_base_alignments)
	(vect_verify_datarefs_alignment, vect_peeling_supportable)
	(vect_analyze_data_ref_accesses, vect_prune_runtime_alias_test_list)
	(vect_analyze_data_refs): Likewise.
	(vect_slp_analyze_data_ref_dependence): Likewise.  Take a vec_info
	argument.
	(vect_find_same_alignment_drs): Likewise.
	(vect_slp_analyze_node_dependences): Update calls accordingly.
	(vect_analyze_data_refs_alignment): Likewise.  Use vec_info::lookup_dr
	instead of DR_VECT_AUX.
	(vect_get_peeling_costs_all_drs): Take a loop_vec_info instead
	of a vector data references.  Use vec_info::lookup_dr instead of
	DR_VECT_AUX.
	(vect_peeling_hash_get_lowest_cost): Update calls accordingly.
	(vect_enhance_data_refs_alignment): Likewise.  Use vec_info::lookup_dr
	instead of DR_VECT_AUX.

From-SVN: r263155
parent 1e5e6ff5
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (vec_info::lookup_dr): New member function.
(vect_dr_stmt): Delete.
* tree-vectorizer.c (vec_info::lookup_dr): New function.
* tree-vect-loop-manip.c (vect_update_inits_of_drs): Use it instead
of DR_VECT_AUX.
* tree-vect-data-refs.c (vect_analyze_possibly_independent_ddr)
(vect_analyze_data_ref_dependence, vect_record_base_alignments)
(vect_verify_datarefs_alignment, vect_peeling_supportable)
(vect_analyze_data_ref_accesses, vect_prune_runtime_alias_test_list)
(vect_analyze_data_refs): Likewise.
(vect_slp_analyze_data_ref_dependence): Likewise. Take a vec_info
argument.
(vect_find_same_alignment_drs): Likewise.
(vect_slp_analyze_node_dependences): Update calls accordingly.
(vect_analyze_data_refs_alignment): Likewise. Use vec_info::lookup_dr
instead of DR_VECT_AUX.
(vect_get_peeling_costs_all_drs): Take a loop_vec_info instead
of a vector data references. Use vec_info::lookup_dr instead of
DR_VECT_AUX.
(vect_peeling_hash_get_lowest_cost): Update calls accordingly.
(vect_enhance_data_refs_alignment): Likewise. Use vec_info::lookup_dr
instead of DR_VECT_AUX.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
* tree-vectorizer.h (_loop_vec_info::unaligned_dr): Change to
dr_vec_info.
* tree-vect-data-refs.c (vect_enhance_data_refs_alignment): Update
......
......@@ -1754,8 +1754,8 @@ vect_update_inits_of_drs (loop_vec_info loop_vinfo, tree niters,
FOR_EACH_VEC_ELT (datarefs, i, dr)
{
gimple *stmt = DR_STMT (dr);
if (!STMT_VINFO_GATHER_SCATTER_P (vinfo_for_stmt (stmt)))
dr_vec_info *dr_info = loop_vinfo->lookup_dr (dr);
if (!STMT_VINFO_GATHER_SCATTER_P (dr_info->stmt))
vect_update_init_of_dr (dr, niters, code);
}
}
......
......@@ -562,6 +562,17 @@ vec_info::lookup_single_use (tree lhs)
return NULL;
}
/* Return vectorization information about DR. */
dr_vec_info *
vec_info::lookup_dr (data_reference *dr)
{
stmt_vec_info stmt_info = lookup_stmt (DR_STMT (dr));
/* DR_STMT should never refer to a stmt in a pattern replacement. */
gcc_checking_assert (!is_pattern_stmt_p (stmt_info));
return STMT_VINFO_DR_INFO (stmt_info->dr_aux.stmt);
}
/* Record that NEW_STMT_INFO now implements the same data reference
as OLD_STMT_INFO. */
......
......@@ -240,6 +240,7 @@ struct vec_info {
stmt_vec_info lookup_stmt (gimple *);
stmt_vec_info lookup_def (tree);
stmt_vec_info lookup_single_use (tree);
struct dr_vec_info *lookup_dr (data_reference *);
void move_dr (stmt_vec_info, stmt_vec_info);
/* The type of vectorization. */
......@@ -1062,8 +1063,6 @@ STMT_VINFO_BB_VINFO (stmt_vec_info stmt_vinfo)
#define PURE_SLP_STMT(S) ((S)->slp_type == pure_slp)
#define STMT_SLP_TYPE(S) (S)->slp_type
#define DR_VECT_AUX(dr) (STMT_VINFO_DR_INFO (vect_dr_stmt (dr)))
#define VECT_MAX_COST 1000
/* The maximum number of intermediate steps required in multi-step type
......@@ -1273,20 +1272,6 @@ add_stmt_costs (void *data, stmt_vector_for_cost *cost_vec)
cost->misalign, cost->where);
}
/* Return the stmt DR is in. For DR_STMT that have been replaced by
a pattern this returns the corresponding pattern stmt. Otherwise
DR_STMT is returned. */
inline stmt_vec_info
vect_dr_stmt (data_reference *dr)
{
gimple *stmt = DR_STMT (dr);
stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
/* DR_STMT should never refer to a stmt in a pattern replacement. */
gcc_checking_assert (!is_pattern_stmt_p (stmt_info));
return stmt_info->dr_aux.stmt;
}
/*-----------------------------------------------------------------*/
/* Info on data references alignment. */
/*-----------------------------------------------------------------*/
......
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