aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vectorizer.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2018-07-31 14:26:22 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-07-31 14:26:22 +0000
commit9d97912b85ac4a86767f4f1b6c47efa1ce0ba6af (patch)
treecf5cf98ba7b03603056288cb5b59dda9ca31e53f /gcc/tree-vectorizer.c
parentb5b56c2a039cd308a9d00fc35baf65c1fb59070b (diff)
downloadgcc-9d97912b85ac4a86767f4f1b6c47efa1ce0ba6af.zip
gcc-9d97912b85ac4a86767f4f1b6c47efa1ce0ba6af.tar.gz
gcc-9d97912b85ac4a86767f4f1b6c47efa1ce0ba6af.tar.bz2
[42/46] Add vec_info::replace_stmt
This patch adds a helper for replacing a stmt_vec_info's statement with a new statement. 2018-07-31 Richard Sandiford <richard.sandiford@arm.com> gcc/ * 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. * tree-vect-stmts.c (vectorizable_call): Likewise. (vectorizable_simd_clone_call): Likewise. From-SVN: r263157
Diffstat (limited to 'gcc/tree-vectorizer.c')
-rw-r--r--gcc/tree-vectorizer.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/tree-vectorizer.c b/gcc/tree-vectorizer.c
index abdc6cd..6e647ab 100644
--- a/gcc/tree-vectorizer.c
+++ b/gcc/tree-vectorizer.c
@@ -602,6 +602,22 @@ vec_info::remove_stmt (stmt_vec_info stmt_info)
free_stmt_vec_info (stmt_info);
}
+/* Replace the statement at GSI by NEW_STMT, both the vectorization
+ information and the function itself. STMT_INFO describes the statement
+ at GSI. */
+
+void
+vec_info::replace_stmt (gimple_stmt_iterator *gsi, stmt_vec_info stmt_info,
+ gimple *new_stmt)
+{
+ gimple *old_stmt = stmt_info->stmt;
+ gcc_assert (!stmt_info->pattern_stmt_p && old_stmt == gsi_stmt (*gsi));
+ set_vinfo_for_stmt (old_stmt, NULL);
+ set_vinfo_for_stmt (new_stmt, stmt_info);
+ stmt_info->stmt = new_stmt;
+ gsi_replace (gsi, new_stmt, true);
+}
+
/* A helper function to free scev and LOOP niter information, as well as
clear loop constraint LOOP_C_FINITE. */