diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2018-07-31 14:23:29 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-07-31 14:23:29 +0000 |
commit | bffb8014d0566af64c3cd5c7afac21c125a14df2 (patch) | |
tree | 1a875c5d43b72c10cf6aae018cb86f8a28eef983 /gcc/tree-vect-loop.c | |
parent | 78e02b3bbb00fc898c550b88161838eb5dd95806 (diff) | |
download | gcc-bffb8014d0566af64c3cd5c7afac21c125a14df2.zip gcc-bffb8014d0566af64c3cd5c7afac21c125a14df2.tar.gz gcc-bffb8014d0566af64c3cd5c7afac21c125a14df2.tar.bz2 |
[20/46] Make *FIRST_ELEMENT and *NEXT_ELEMENT stmt_vec_infos
This patch changes {REDUC,DR}_GROUP_{FIRST,NEXT} element from a
gimple stmt to stmt_vec_info.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vectorizer.h (_stmt_vec_info::first_element): Change from
a gimple stmt to a stmt_vec_info.
(_stmt_vec_info::next_element): Likewise.
* tree-vect-data-refs.c (vect_update_misalignment_for_peel)
(vect_slp_analyze_and_verify_node_alignment)
(vect_analyze_group_access_1, vect_analyze_group_access)
(vect_small_gap_p, vect_prune_runtime_alias_test_list)
(vect_create_data_ref_ptr, vect_record_grouped_load_vectors)
(vect_supportable_dr_alignment): Update accordingly.
* tree-vect-loop.c (vect_fixup_reduc_chain): Likewise.
(vect_fixup_scalar_cycles_with_patterns, vect_is_slp_reduction)
(vect_is_simple_reduction, vectorizable_reduction): Likewise.
* tree-vect-patterns.c (vect_reassociating_reduction_p): Likewise.
* tree-vect-slp.c (vect_build_slp_tree_1)
(vect_attempt_slp_rearrange_stmts, vect_supported_load_permutation_p)
(vect_split_slp_store_group, vect_analyze_slp_instance)
(vect_analyze_slp, vect_transform_slp_perm_load): Likewise.
* tree-vect-stmts.c (vect_model_store_cost, vect_model_load_cost)
(get_group_load_store_type, get_load_store_type)
(get_group_alias_ptr_type, vectorizable_store, vectorizable_load)
(vect_transform_stmt, vect_remove_stores): Likewise.
From-SVN: r263135
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 3ac4aee..0b5631b 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -661,14 +661,14 @@ vect_fixup_reduc_chain (gimple *stmt) REDUC_GROUP_SIZE (firstp) = REDUC_GROUP_SIZE (stmt_info); do { - stmtp = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (stmt)); + stmtp = STMT_VINFO_RELATED_STMT (stmt_info); REDUC_GROUP_FIRST_ELEMENT (stmtp) = firstp; - stmt = REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (stmt)); - if (stmt) + stmt_info = REDUC_GROUP_NEXT_ELEMENT (stmt_info); + if (stmt_info) REDUC_GROUP_NEXT_ELEMENT (stmtp) - = STMT_VINFO_RELATED_STMT (vinfo_for_stmt (stmt)); + = STMT_VINFO_RELATED_STMT (stmt_info); } - while (stmt); + while (stmt_info); STMT_VINFO_DEF_TYPE (stmtp) = vect_reduction_def; } @@ -683,12 +683,12 @@ vect_fixup_scalar_cycles_with_patterns (loop_vec_info loop_vinfo) FOR_EACH_VEC_ELT (LOOP_VINFO_REDUCTION_CHAINS (loop_vinfo), i, first) if (STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (first))) { - gimple *next = REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (first)); + stmt_vec_info next = REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (first)); while (next) { - if (! STMT_VINFO_IN_PATTERN_P (vinfo_for_stmt (next))) + if (! STMT_VINFO_IN_PATTERN_P (next)) break; - next = REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (next)); + next = REDUC_GROUP_NEXT_ELEMENT (next); } /* If not all stmt in the chain are patterns try to handle the chain without patterns. */ @@ -2188,7 +2188,7 @@ again: vinfo = SLP_TREE_SCALAR_STMTS (SLP_INSTANCE_TREE (instance))[0]; if (! STMT_VINFO_GROUPED_ACCESS (vinfo)) continue; - vinfo = vinfo_for_stmt (DR_GROUP_FIRST_ELEMENT (vinfo)); + vinfo = DR_GROUP_FIRST_ELEMENT (vinfo); unsigned int size = DR_GROUP_SIZE (vinfo); tree vectype = STMT_VINFO_VECTYPE (vinfo); if (! vect_store_lanes_supported (vectype, size, false) @@ -2198,7 +2198,7 @@ again: FOR_EACH_VEC_ELT (SLP_INSTANCE_LOADS (instance), j, node) { vinfo = SLP_TREE_SCALAR_STMTS (node)[0]; - vinfo = vinfo_for_stmt (DR_GROUP_FIRST_ELEMENT (vinfo)); + vinfo = DR_GROUP_FIRST_ELEMENT (vinfo); bool single_element_p = !DR_GROUP_NEXT_ELEMENT (vinfo); size = DR_GROUP_SIZE (vinfo); vectype = STMT_VINFO_VECTYPE (vinfo); @@ -2527,7 +2527,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi, struct loop *loop = (gimple_bb (phi))->loop_father; struct loop *vect_loop = LOOP_VINFO_LOOP (loop_info); enum tree_code code; - gimple *loop_use_stmt = NULL, *first, *next_stmt; + gimple *loop_use_stmt = NULL; stmt_vec_info use_stmt_info, current_stmt_info = NULL; tree lhs; imm_use_iterator imm_iter; @@ -2592,12 +2592,12 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi, use_stmt_info = loop_info->lookup_stmt (loop_use_stmt); if (current_stmt_info) { - REDUC_GROUP_NEXT_ELEMENT (current_stmt_info) = loop_use_stmt; + REDUC_GROUP_NEXT_ELEMENT (current_stmt_info) = use_stmt_info; REDUC_GROUP_FIRST_ELEMENT (use_stmt_info) = REDUC_GROUP_FIRST_ELEMENT (current_stmt_info); } else - REDUC_GROUP_FIRST_ELEMENT (use_stmt_info) = loop_use_stmt; + REDUC_GROUP_FIRST_ELEMENT (use_stmt_info) = use_stmt_info; lhs = gimple_assign_lhs (loop_use_stmt); current_stmt_info = use_stmt_info; @@ -2610,9 +2610,10 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi, /* Swap the operands, if needed, to make the reduction operand be the second operand. */ lhs = PHI_RESULT (phi); - next_stmt = REDUC_GROUP_FIRST_ELEMENT (current_stmt_info); - while (next_stmt) + stmt_vec_info next_stmt_info = REDUC_GROUP_FIRST_ELEMENT (current_stmt_info); + while (next_stmt_info) { + gassign *next_stmt = as_a <gassign *> (next_stmt_info->stmt); if (gimple_assign_rhs2 (next_stmt) == lhs) { tree op = gimple_assign_rhs1 (next_stmt); @@ -2626,7 +2627,7 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi, && vect_valid_reduction_input_p (def_stmt_info)) { lhs = gimple_assign_lhs (next_stmt); - next_stmt = REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (next_stmt)); + next_stmt_info = REDUC_GROUP_NEXT_ELEMENT (next_stmt_info); continue; } @@ -2663,13 +2664,14 @@ vect_is_slp_reduction (loop_vec_info loop_info, gimple *phi, } lhs = gimple_assign_lhs (next_stmt); - next_stmt = REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (next_stmt)); + next_stmt_info = REDUC_GROUP_NEXT_ELEMENT (next_stmt_info); } /* Save the chain for further analysis in SLP detection. */ - first = REDUC_GROUP_FIRST_ELEMENT (current_stmt_info); - LOOP_VINFO_REDUCTION_CHAINS (loop_info).safe_push (first); - REDUC_GROUP_SIZE (vinfo_for_stmt (first)) = size; + stmt_vec_info first_stmt_info + = REDUC_GROUP_FIRST_ELEMENT (current_stmt_info); + LOOP_VINFO_REDUCTION_CHAINS (loop_info).safe_push (first_stmt_info); + REDUC_GROUP_SIZE (first_stmt_info) = size; return true; } @@ -3254,12 +3256,12 @@ vect_is_simple_reduction (loop_vec_info loop_info, stmt_vec_info phi_info, } /* Dissolve group eventually half-built by vect_is_slp_reduction. */ - gimple *first = REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (def_stmt)); + stmt_vec_info first = REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (def_stmt)); while (first) { - gimple *next = REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (first)); - REDUC_GROUP_FIRST_ELEMENT (vinfo_for_stmt (first)) = NULL; - REDUC_GROUP_NEXT_ELEMENT (vinfo_for_stmt (first)) = NULL; + stmt_vec_info next = REDUC_GROUP_NEXT_ELEMENT (first); + REDUC_GROUP_FIRST_ELEMENT (first) = NULL; + REDUC_GROUP_NEXT_ELEMENT (first) = NULL; first = next; } @@ -6130,7 +6132,8 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, } if (REDUC_GROUP_FIRST_ELEMENT (stmt_info)) - gcc_assert (slp_node && REDUC_GROUP_FIRST_ELEMENT (stmt_info) == stmt); + gcc_assert (slp_node + && REDUC_GROUP_FIRST_ELEMENT (stmt_info) == stmt_info); if (gimple_code (stmt) == GIMPLE_PHI) { @@ -6784,8 +6787,8 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, tree neutral_op = NULL_TREE; if (slp_node) neutral_op = neutral_op_for_slp_reduction - (slp_node_instance->reduc_phis, code, - REDUC_GROUP_FIRST_ELEMENT (stmt_info) != NULL); + (slp_node_instance->reduc_phis, code, + REDUC_GROUP_FIRST_ELEMENT (stmt_info) != NULL_STMT_VEC_INFO); if (double_reduc && reduction_type == FOLD_LEFT_REDUCTION) { |