aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.c
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2018-08-01 14:59:51 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2018-08-01 14:59:51 +0000
commit211cd1e2358d52d3863f727b650c65650dd5ce89 (patch)
tree476a8a7f646d5bbc213770789b6a60427671b4fb /gcc/tree-vect-loop.c
parentb0b45e582f31b496ea37a76a20b1f79b25165635 (diff)
downloadgcc-211cd1e2358d52d3863f727b650c65650dd5ce89.zip
gcc-211cd1e2358d52d3863f727b650c65650dd5ce89.tar.gz
gcc-211cd1e2358d52d3863f727b650c65650dd5ce89.tar.bz2
[04/11] Add a vect_orig_stmt helper function
This patch just adds a helper function for going from a potential pattern statement to the original scalar statement. 2018-08-01 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vectorizer.h (vect_orig_stmt): New function. * tree-vect-data-refs.c (vect_preserves_scalar_order_p): Use it. * tree-vect-loop.c (vect_model_reduction_cost): Likewise. (vect_create_epilog_for_reduction): Likewise. (vectorizable_live_operation): Likewise. * tree-vect-slp.c (vect_find_last_scalar_stmt_in_slp): Likewise. (vect_detect_hybrid_slp_stmts, vect_schedule_slp): Likewise. * tree-vect-stmts.c (vectorizable_call): Likewise. (vectorizable_simd_clone_call, vect_remove_stores): Likewise. From-SVN: r263217
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r--gcc/tree-vect-loop.c26
1 files changed, 6 insertions, 20 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c
index 29f980a..b5d1671 100644
--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -3814,10 +3814,7 @@ vect_model_reduction_cost (stmt_vec_info stmt_info, internal_fn reduc_fn,
vectype = STMT_VINFO_VECTYPE (stmt_info);
mode = TYPE_MODE (vectype);
- stmt_vec_info orig_stmt_info = STMT_VINFO_RELATED_STMT (stmt_info);
-
- if (!orig_stmt_info)
- orig_stmt_info = stmt_info;
+ stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info);
code = gimple_assign_rhs_code (orig_stmt_info->stmt);
@@ -4738,13 +4735,8 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs,
Otherwise (it is a regular reduction) - the tree-code and scalar-def
are taken from STMT. */
- stmt_vec_info orig_stmt_info = STMT_VINFO_RELATED_STMT (stmt_info);
- if (!orig_stmt_info)
- {
- /* Regular reduction */
- orig_stmt_info = stmt_info;
- }
- else
+ stmt_vec_info orig_stmt_info = vect_orig_stmt (stmt_info);
+ if (orig_stmt_info != stmt_info)
{
/* Reduction pattern */
gcc_assert (STMT_VINFO_IN_PATTERN_P (orig_stmt_info));
@@ -5540,11 +5532,7 @@ vect_finalize_reduction:
if (REDUC_GROUP_FIRST_ELEMENT (stmt_info))
{
stmt_vec_info dest_stmt_info
- = SLP_TREE_SCALAR_STMTS (slp_node)[group_size - 1];
- /* Handle reduction patterns. */
- if (STMT_VINFO_RELATED_STMT (dest_stmt_info))
- dest_stmt_info = STMT_VINFO_RELATED_STMT (dest_stmt_info);
-
+ = vect_orig_stmt (SLP_TREE_SCALAR_STMTS (slp_node)[group_size - 1]);
scalar_dest = gimple_assign_lhs (dest_stmt_info->stmt);
group_size = 1;
}
@@ -7898,10 +7886,8 @@ vectorizable_live_operation (stmt_vec_info stmt_info,
return true;
}
- /* If stmt has a related stmt, then use that for getting the lhs. */
- gimple *stmt = (is_pattern_stmt_p (stmt_info)
- ? STMT_VINFO_RELATED_STMT (stmt_info)->stmt
- : stmt_info->stmt);
+ /* Use the lhs of the original scalar statement. */
+ gimple *stmt = vect_orig_stmt (stmt_info)->stmt;
lhs = (is_a <gphi *> (stmt)) ? gimple_phi_result (stmt)
: gimple_get_lhs (stmt);