diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2018-07-31 14:24:02 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-07-31 14:24:02 +0000 |
commit | 91987857e694109fa312c9d2d83785aee5fb9c28 (patch) | |
tree | 3b452bba62175cb7ca1c21add51e201f53792dd3 /gcc/tree-vect-loop.c | |
parent | beb456c375ea71d57e35400e9b7107e09e996965 (diff) | |
download | gcc-91987857e694109fa312c9d2d83785aee5fb9c28.zip gcc-91987857e694109fa312c9d2d83785aee5fb9c28.tar.gz gcc-91987857e694109fa312c9d2d83785aee5fb9c28.tar.bz2 |
[27/46] Remove duplicated stmt_vec_info lookups
Various places called vect_dr_stmt or vinfo_for_stmt multiple times
on the same input. This patch makes them reuse the earlier result.
It also splits a couple of single vinfo_for_stmt calls out into
separate statements so that they can be reused in later patches.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vect-data-refs.c (vect_analyze_data_ref_dependence)
(vect_slp_analyze_node_dependences, vect_analyze_data_ref_accesses)
(vect_permute_store_chain, vect_permute_load_chain)
(vect_shift_permute_load_chain, vect_transform_grouped_load): Avoid
repeated stmt_vec_info lookups.
* tree-vect-loop-manip.c (vect_can_advance_ivs_p): Likewise.
(vect_update_ivs_after_vectorizer): Likewise.
* tree-vect-loop.c (vect_is_simple_reduction): Likewise.
(vect_create_epilog_for_reduction, vectorizable_reduction): Likewise.
* tree-vect-patterns.c (adjust_bool_stmts): Likewise.
* tree-vect-slp.c (vect_analyze_slp_instance): Likewise.
(vect_bb_slp_scalar_cost): Likewise.
* tree-vect-stmts.c (get_group_alias_ptr_type): Likewise.
From-SVN: r263142
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index caa1c6b..3060d84 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -3252,7 +3252,7 @@ vect_is_simple_reduction (loop_vec_info loop_info, stmt_vec_info phi_info, } /* Dissolve group eventually half-built by vect_is_slp_reduction. */ - stmt_vec_info first = REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (def_stmt)); + stmt_vec_info first = REDUC_GROUP_FIRST_ELEMENT (def_stmt_info); while (first) { stmt_vec_info next = REDUC_GROUP_NEXT_ELEMENT (first); @@ -4784,7 +4784,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt, # b1 = phi <b2, b0> a2 = operation (a1) b2 = operation (b1) */ - slp_reduc = (slp_node && !REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt))); + slp_reduc = (slp_node && !REDUC_GROUP_FIRST_ELEMENT (stmt_info)); /* True if we should implement SLP_REDUC using native reduction operations instead of scalar operations. */ @@ -4799,7 +4799,7 @@ vect_create_epilog_for_reduction (vec<tree> vect_defs, gimple *stmt, we may end up with more than one vector result. Here we reduce them to one vector. */ - if (REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) || direct_slp_reduc) + if (REDUC_GROUP_FIRST_ELEMENT (stmt_info) || direct_slp_reduc) { tree first_vect = PHI_RESULT (new_phis[0]); gassign *new_vec_stmt = NULL; @@ -5544,7 +5544,7 @@ vect_finalize_reduction: necessary, hence we set here REDUC_GROUP_SIZE to 1. SCALAR_DEST is the LHS of the last stmt in the reduction chain, since we are looking for the loop exit phi node. */ - if (REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt))) + if (REDUC_GROUP_FIRST_ELEMENT (stmt_info)) { stmt_vec_info dest_stmt_info = SLP_TREE_SCALAR_STMTS (slp_node)[group_size - 1]; @@ -6095,8 +6095,8 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, tree cond_reduc_val = NULL_TREE; /* Make sure it was already recognized as a reduction computation. */ - if (STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) != vect_reduction_def - && STMT_VINFO_DEF_TYPE (vinfo_for_stmt (stmt)) != vect_nested_cycle) + if (STMT_VINFO_DEF_TYPE (stmt_info) != vect_reduction_def + && STMT_VINFO_DEF_TYPE (stmt_info) != vect_nested_cycle) return false; if (nested_in_vect_loop_p (loop, stmt)) @@ -6789,7 +6789,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, if (reduction_type == FOLD_LEFT_REDUCTION && slp_node - && !REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt))) + && !REDUC_GROUP_FIRST_ELEMENT (stmt_info)) { /* We cannot use in-order reductions in this case because there is an implicit reassociation of the operations involved. */ @@ -6818,7 +6818,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, /* Check extra constraints for variable-length unchained SLP reductions. */ if (STMT_SLP_TYPE (stmt_info) - && !REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (stmt)) + && !REDUC_GROUP_FIRST_ELEMENT (stmt_info) && !nunits_out.is_constant ()) { /* We checked above that we could build the initial vector when |