aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2018-07-31 14:26:26 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-07-31 14:26:26 +0000
commit458135c0354f19eb2bd032d42c27076def8c31de (patch)
treedad2ef0425346eb33826305bf3ea6783adaf6409 /gcc
parent9d97912b85ac4a86767f4f1b6c47efa1ce0ba6af (diff)
downloadgcc-458135c0354f19eb2bd032d42c27076def8c31de.zip
gcc-458135c0354f19eb2bd032d42c27076def8c31de.tar.gz
gcc-458135c0354f19eb2bd032d42c27076def8c31de.tar.bz2
[43/46] Make free_stmt_vec_info take a stmt_vec_info
This patch makes free_stmt_vec_info take the stmt_vec_info that it's supposed to free and makes it free only that stmt_vec_info. Callers need to update the statement mapping where necessary (but now there are only a couple of callers). This in turns means that we can leave ~vec_info to do the actual freeing, since there's no longer a need to do it before resetting the gimple_uids. 2018-07-31 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vectorizer.h (free_stmt_vec_info): Take a stmt_vec_info rather than a gimple stmt. * tree-vect-stmts.c (free_stmt_vec_info): Likewise. Don't free information for pattern statements when passed the original statement; instead wait to be passed the pattern statement itself. Don't call set_vinfo_for_stmt here. (free_stmt_vec_infos): Update call to free_stmt_vec_info. * tree-vect-loop.c (_loop_vec_info::~loop_vec_info): Don't free stmt_vec_infos here. * tree-vect-slp.c (_bb_vec_info::~bb_vec_info): Likewise. * tree-vectorizer.c (vec_info::remove_stmt): Nullify the statement's stmt_vec_infos entry. From-SVN: r263158
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog15
-rw-r--r--gcc/tree-vect-loop.c6
-rw-r--r--gcc/tree-vect-slp.c13
-rw-r--r--gcc/tree-vect-stmts.c40
-rw-r--r--gcc/tree-vectorizer.c1
-rw-r--r--gcc/tree-vectorizer.h2
6 files changed, 26 insertions, 51 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bee475c..8590a54 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,20 @@
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
+ * tree-vectorizer.h (free_stmt_vec_info): Take a stmt_vec_info
+ rather than a gimple stmt.
+ * tree-vect-stmts.c (free_stmt_vec_info): Likewise. Don't free
+ information for pattern statements when passed the original
+ statement; instead wait to be passed the pattern statement itself.
+ Don't call set_vinfo_for_stmt here.
+ (free_stmt_vec_infos): Update call to free_stmt_vec_info.
+ * tree-vect-loop.c (_loop_vec_info::~loop_vec_info): Don't free
+ stmt_vec_infos here.
+ * tree-vect-slp.c (_bb_vec_info::~bb_vec_info): Likewise.
+ * tree-vectorizer.c (vec_info::remove_stmt): Nullify the statement's
+ stmt_vec_infos entry.
+
+2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
+
* tree-vectorizer.h (vec_info::replace_stmt): Declare.
* tree-vectorizer.c (vec_info::replace_stmt): New function.
* tree-vect-slp.c (vect_remove_slp_scalar_calls): Use it.
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 6a00695..840b38c 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -894,9 +894,6 @@ _loop_vec_info::~_loop_vec_info ()
for (j = 0; j < nbbs; j++)
{
basic_block bb = bbs[j];
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
- free_stmt_vec_info (gsi_stmt (si));
-
for (si = gsi_start_bb (bb); !gsi_end_p (si); )
{
gimple *stmt = gsi_stmt (si);
@@ -936,9 +933,6 @@ _loop_vec_info::~_loop_vec_info ()
}
}
}
-
- /* Free stmt_vec_info. */
- free_stmt_vec_info (stmt);
gsi_next (&si);
}
}
diff --git a/gcc/tree-vect-slp.c b/gcc/tree-vect-slp.c
index abaddd7..6b68611 100644
--- a/gcc/tree-vect-slp.c
+++ b/gcc/tree-vect-slp.c
@@ -2490,17 +2490,8 @@ _bb_vec_info::~_bb_vec_info ()
{
for (gimple_stmt_iterator si = region_begin;
gsi_stmt (si) != gsi_stmt (region_end); gsi_next (&si))
- {
- gimple *stmt = gsi_stmt (si);
- stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
-
- if (stmt_info)
- /* Free stmt_vec_info. */
- free_stmt_vec_info (stmt);
-
- /* Reset region marker. */
- gimple_set_uid (stmt, -1);
- }
+ /* Reset region marker. */
+ gimple_set_uid (gsi_stmt (si), -1);
bb->aux = NULL;
}
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index 05f9c5c..12f1cac 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -9918,7 +9918,7 @@ free_stmt_vec_infos (vec<stmt_vec_info> *v)
stmt_vec_info info;
FOR_EACH_VEC_ELT (*v, i, info)
if (info != NULL_STMT_VEC_INFO)
- free_stmt_vec_info (STMT_VINFO_STMT (info));
+ free_stmt_vec_info (info);
if (v == stmt_vec_info_vec)
stmt_vec_info_vec = NULL;
v->release ();
@@ -9928,44 +9928,18 @@ free_stmt_vec_infos (vec<stmt_vec_info> *v)
/* Free stmt vectorization related info. */
void
-free_stmt_vec_info (gimple *stmt)
+free_stmt_vec_info (stmt_vec_info stmt_info)
{
- stmt_vec_info stmt_info = vinfo_for_stmt (stmt);
-
- if (!stmt_info)
- return;
-
- /* Check if this statement has a related "pattern stmt"
- (introduced by the vectorizer during the pattern recognition
- pass). Free pattern's stmt_vec_info and def stmt's stmt_vec_info
- too. */
- if (STMT_VINFO_IN_PATTERN_P (stmt_info))
+ if (stmt_info->pattern_stmt_p)
{
- if (gimple_seq seq = STMT_VINFO_PATTERN_DEF_SEQ (stmt_info))
- for (gimple_stmt_iterator si = gsi_start (seq);
- !gsi_end_p (si); gsi_next (&si))
- {
- gimple *seq_stmt = gsi_stmt (si);
- gimple_set_bb (seq_stmt, NULL);
- tree lhs = gimple_get_lhs (seq_stmt);
- if (lhs && TREE_CODE (lhs) == SSA_NAME)
- release_ssa_name (lhs);
- free_stmt_vec_info (seq_stmt);
- }
- stmt_vec_info patt_stmt_info = STMT_VINFO_RELATED_STMT (stmt_info);
- if (patt_stmt_info)
- {
- gimple_set_bb (patt_stmt_info->stmt, NULL);
- tree lhs = gimple_get_lhs (patt_stmt_info->stmt);
- if (lhs && TREE_CODE (lhs) == SSA_NAME)
- release_ssa_name (lhs);
- free_stmt_vec_info (patt_stmt_info);
- }
+ gimple_set_bb (stmt_info->stmt, NULL);
+ tree lhs = gimple_get_lhs (stmt_info->stmt);
+ if (lhs && TREE_CODE (lhs) == SSA_NAME)
+ release_ssa_name (lhs);
}
STMT_VINFO_SAME_ALIGN_REFS (stmt_info).release ();
STMT_VINFO_SIMD_CLONE_INFO (stmt_info).release ();
- set_vinfo_for_stmt (stmt, NULL);
free (stmt_info);
}
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index 6e647ab..bb6a154 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -595,6 +595,7 @@ void
vec_info::remove_stmt (stmt_vec_info stmt_info)
{
gcc_assert (!stmt_info->pattern_stmt_p);
+ set_vinfo_for_stmt (stmt_info->stmt, NULL);
gimple_stmt_iterator si = gsi_for_stmt (stmt_info->stmt);
unlink_stmt_vdef (stmt_info->stmt);
gsi_remove (&si, true);
diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h
index c7b0515..b9aa9c4 100644
--- a/gcc/tree-vectorizer.h
+++ b/gcc/tree-vectorizer.h
@@ -1503,7 +1503,7 @@ extern bool supportable_narrowing_operation (enum tree_code, tree, tree,
enum tree_code *,
int *, vec<tree> *);
extern stmt_vec_info new_stmt_vec_info (gimple *stmt, vec_info *);
-extern void free_stmt_vec_info (gimple *stmt);
+extern void free_stmt_vec_info (stmt_vec_info);
extern unsigned record_stmt_cost (stmt_vector_for_cost *, int,
enum vect_cost_for_stmt, stmt_vec_info,
int, enum vect_cost_model_location);