aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2018-06-25 11:04:01 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2018-06-25 11:04:01 +0000
commitca823c85882f5a0ca9779d8cd7adfcec02549d3b (patch)
tree5ba2be9dfcf5d0e1a7deb28abaeace299556a695 /gcc/tree-vectorizer.c
parentf2227a6696f136a181a208d291eb44769a7721e0 (diff)
downloadgcc-ca823c85882f5a0ca9779d8cd7adfcec02549d3b.zip
gcc-ca823c85882f5a0ca9779d8cd7adfcec02549d3b.tar.gz
gcc-ca823c85882f5a0ca9779d8cd7adfcec02549d3b.tar.bz2
tree-vectorizer.h (struct vec_info_shared): New structure with parts split out from struct vec_info and loop_nest from...
2018-06-25 Richard Biener <rguenther@suse.de> * tree-vectorizer.h (struct vec_info_shared): New structure with parts split out from struct vec_info and loop_nest from struct _loop_vec_info. (struct vec_info): Adjust accordingly. (struct _loop_vec_info): Likewise. (LOOP_VINFO_LOOP_NEST): Adjust. (LOOP_VINFO_DATAREFS): Likewise. (LOOP_VINFO_DDRS): Likewise. (struct _bb_vec_info): Likewise. (BB_VINFO_DATAREFS): Likewise. (BB_VINFO_DDRS): Likewise. (struct _stmt_vec_info): Add dr_aux member. (DR_VECT_AUX): Adjust to refer to member of DR_STMTs vinfo. (DR_MISALIGNMENT_UNINITIALIZED): New. (set_dr_misalignment): Adjust. (dr_misalignment): Assert misalign isn't DR_MISALIGNMENT_UNINITIALIZED. (vect_analyze_loop): Adjust prototype. (vect_analyze_loop_form): Likewise. * tree-vect-data-refs.c (vect_analyze_data_ref_dependences): Compute dependences lazily. (vect_record_base_alignments): Use shared datarefs/ddrs. (vect_verify_datarefs_alignment): Likewise. (vect_analyze_data_refs_alignment): Likewise. (vect_analyze_data_ref_accesses): Likewise. (vect_analyze_data_refs): Likewise. * tree-vect-loop.c (_loop_vec_info::_loop_vec_info): Add constructor parameter for shared part. (vect_analyze_loop_form): Pass in shared part and adjust. (vect_analyze_loop_2): Pass in storage for the number of stmts. Move loop nest finding to the caller. Compute datarefs lazily. (vect_analyze_loop): Pass in shared part. (vect_transform_loop): Verify shared datarefs are unchanged. * tree-vect-slp.c (_bb_vec_info::_bb_vec_info): Add constructor parameter for shared part. (vect_slp_analyze_bb_1): Pass in shared part and adjust. (vect_slp_bb): Verify shared datarefs are unchanged before transform. * tree-vect-stmts.c (ensure_base_align): Adjust for DR_AUX change. (new_stmt_vec_info): Initialize DR_AUX misalignment to DR_MISALIGNMENT_UNINITIALIZED. * tree-vectorizer.c (vec_info::vec_info): Add constructor parameter for shared part. (vec_info::~vec_info): Adjust. (vec_info_shared::vec_info_shared): New. (vec_info_shared::~vec_info_shared): Likewise. (vec_info_shared::save_datarefs): Likewise. (vec_info_shared::check_datarefs): Likewise. (try_vectorize_loop_1): Construct shared part live for analyses of a single loop for multiple vector sizes. * tree-parloops.c (gather_scalar_reductions): Adjust. From-SVN: r262009
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c54
1 files changed, 40 insertions, 14 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 1c487e6..41f5365 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -450,10 +450,10 @@ shrink_simd_arrays
/* Initialize the vec_info with kind KIND_IN and target cost data
TARGET_COST_DATA_IN. */
-vec_info::vec_info (vec_info::vec_kind kind_in, void *target_cost_data_in)
+vec_info::vec_info (vec_info::vec_kind kind_in, void *target_cost_data_in,
+ vec_info_shared *shared_)
: kind (kind_in),
- datarefs (vNULL),
- ddrs (vNULL),
+ shared (shared_),
target_cost_data (target_cost_data_in)
{
stmt_vec_infos.create (50);
@@ -463,25 +463,50 @@ vec_info::vec_info (vec_info::vec_kind kind_in, void *target_cost_data_in)
vec_info::~vec_info ()
{
slp_instance instance;
- struct data_reference *dr;
unsigned int i;
- FOR_EACH_VEC_ELT (datarefs, i, dr)
- if (dr->aux)
- {
- free (dr->aux);
- dr->aux = NULL;
- }
-
FOR_EACH_VEC_ELT (slp_instances, i, instance)
vect_free_slp_instance (instance);
- free_data_refs (datarefs);
- free_dependence_relations (ddrs);
destroy_cost_data (target_cost_data);
free_stmt_vec_infos (&stmt_vec_infos);
}
+vec_info_shared::vec_info_shared ()
+ : datarefs (vNULL),
+ datarefs_copy (vNULL),
+ ddrs (vNULL)
+{
+}
+
+vec_info_shared::~vec_info_shared ()
+{
+ free_data_refs (datarefs);
+ free_dependence_relations (ddrs);
+ datarefs_copy.release ();
+}
+
+void
+vec_info_shared::save_datarefs ()
+{
+ if (!flag_checking)
+ return;
+ datarefs_copy.reserve_exact (datarefs.length ());
+ for (unsigned i = 0; i < datarefs.length (); ++i)
+ datarefs_copy.quick_push (*datarefs[i]);
+}
+
+void
+vec_info_shared::check_datarefs ()
+{
+ if (!flag_checking)
+ return;
+ gcc_assert (datarefs.length () == datarefs_copy.length ());
+ for (unsigned i = 0; i < datarefs.length (); ++i)
+ if (memcmp (&datarefs_copy[i], datarefs[i], sizeof (data_reference)) != 0)
+ gcc_unreachable ();
+}
+
/* A helper function to free scev and LOOP niter information, as well as
clear loop constraint LOOP_C_FINITE. */
@@ -669,6 +694,7 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
gimple *loop_dist_alias_call)
{
unsigned ret = 0;
+ vec_info_shared shared;
vect_location = find_loop_location (loop);
if (LOCATION_LOCUS (vect_location) != UNKNOWN_LOCATION
&& dump_enabled_p ())
@@ -676,7 +702,7 @@ try_vectorize_loop_1 (hash_table<simduid_to_vf> *&simduid_to_vf_htab,
LOCATION_FILE (vect_location),
LOCATION_LINE (vect_location));
- loop_vec_info loop_vinfo = vect_analyze_loop (loop, orig_loop_vinfo);
+ loop_vec_info loop_vinfo = vect_analyze_loop (loop, orig_loop_vinfo, &shared);
loop->aux = loop_vinfo;
if (!loop_vinfo || !LOOP_VINFO_VECTORIZABLE_P (loop_vinfo))