aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2018-08-01 15:14:42 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-08-01 15:14:42 +0000
commit6e6b18e5fbe6be62334c9007a58224fb3700d43a (patch)
tree9c60cd9b0f1770a384516c649066da81a765c012 /gcc/tree-vect-loop.c
parentcd3ca9102eba6eae8944329cd72b74ff460e7b3b (diff)
downloadgcc-6e6b18e5fbe6be62334c9007a58224fb3700d43a.zip
gcc-6e6b18e5fbe6be62334c9007a58224fb3700d43a.tar.gz
gcc-6e6b18e5fbe6be62334c9007a58224fb3700d43a.tar.bz2
[05/11] Add a vect_stmt_to_vectorize helper function
This patch adds a helper that does the opposite of vect_orig_stmt: go from the original scalar statement to the statement that should actually be vectorised. The use in the last two hunks of vectorizable_reduction are because reduc_stmt_info (first hunk) and stmt_info (second hunk) are already pattern statements if appropriate. 2018-08-01 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vectorizer.h (vect_stmt_to_vectorize): New function. * tree-vect-loop.c (vect_update_vf_for_slp): Use it. (vectorizable_reduction): Likewise. * tree-vect-slp.c (vect_analyze_slp_instance): Likewise. (vect_detect_hybrid_slp_stmts): Likewise. * tree-vect-stmts.c (vect_is_simple_use): Likewise. From-SVN: r263219
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index b5d1671..f4ce5b6 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -1424,9 +1424,7 @@ vect_update_vf_for_slp (loop_vec_info loop_vinfo)
gsi_next (&si))
{
stmt_vec_info stmt_info = loop_vinfo->lookup_stmt (gsi_stmt (si));
- if (STMT_VINFO_IN_PATTERN_P (stmt_info)
- && STMT_VINFO_RELATED_STMT (stmt_info))
- stmt_info = STMT_VINFO_RELATED_STMT (stmt_info);
+ stmt_info = vect_stmt_to_vectorize (stmt_info);
if ((STMT_VINFO_RELEVANT_P (stmt_info)
|| VECTORIZABLE_CYCLE_DEF (STMT_VINFO_DEF_TYPE (stmt_info)))
&& !PURE_SLP_STMT (stmt_info))
@@ -6111,8 +6109,7 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
return true;
stmt_vec_info reduc_stmt_info = STMT_VINFO_REDUC_DEF (stmt_info);
- if (STMT_VINFO_IN_PATTERN_P (reduc_stmt_info))
- reduc_stmt_info = STMT_VINFO_RELATED_STMT (reduc_stmt_info);
+ reduc_stmt_info = vect_stmt_to_vectorize (reduc_stmt_info);
if (STMT_VINFO_VEC_REDUCTION_TYPE (reduc_stmt_info)
== EXTRACT_LAST_REDUCTION)
@@ -6145,8 +6142,7 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (ncopies > 1
&& STMT_VINFO_RELEVANT (reduc_stmt_info) <= vect_used_only_live
&& (use_stmt_info = loop_vinfo->lookup_single_use (phi_result))
- && (use_stmt_info == reduc_stmt_info
- || STMT_VINFO_RELATED_STMT (use_stmt_info) == reduc_stmt_info))
+ && vect_stmt_to_vectorize (use_stmt_info) == reduc_stmt_info)
single_defuse_cycle = true;
/* Create the destination vector */
@@ -6915,8 +6911,7 @@ vectorizable_reduction (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
if (ncopies > 1
&& (STMT_VINFO_RELEVANT (stmt_info) <= vect_used_only_live)
&& (use_stmt_info = loop_vinfo->lookup_single_use (reduc_phi_result))
- && (use_stmt_info == stmt_info
- || STMT_VINFO_RELATED_STMT (use_stmt_info) == stmt_info))
+ && vect_stmt_to_vectorize (use_stmt_info) == stmt_info)
{
single_defuse_cycle = true;
epilog_copies = 1;