diff options
author | Richard Biener <rguenther@suse.de> | 2023-08-09 11:48:28 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-08-10 14:23:16 +0200 |
commit | 9b8ebdb60c463fa3641692a21ca0ce24fba89260 (patch) | |
tree | 0364d1e97ccfb462826ad42709a8b978b2dfb327 /gcc | |
parent | 6bdbf1722a312b90a48dea19af545815f0069e86 (diff) | |
download | gcc-9b8ebdb60c463fa3641692a21ca0ce24fba89260.zip gcc-9b8ebdb60c463fa3641692a21ca0ce24fba89260.tar.gz gcc-9b8ebdb60c463fa3641692a21ca0ce24fba89260.tar.bz2 |
Remove insert location argument from vectorizable_live_operation
The insert location argument isn't actually used but we compute
that ourselves. There's a single spot, namely when asking
for the loop mask via vect_get_loop_mask that the passed argument
is used but that looks like an oversight. The following fixes that
and adjusts vectorizable_live_operation and can_vectorize_live_stmts
to no longer take a stmt iterator argument.
* tree-vectorizer.h (vectorizable_live_operation): Remove
gimple_stmt_iterator * argument.
* tree-vect-loop.cc (vectorizable_live_operation): Likewise.
Adjust plumbing around vect_get_loop_mask.
(vect_analyze_loop_operations): Adjust.
* tree-vect-slp.cc (vect_slp_analyze_node_operations_1): Likewise.
(vect_bb_slp_mark_live_stmts): Likewise.
(vect_schedule_slp_node): Likewise.
* tree-vect-stmts.cc (can_vectorize_live_stmts): Likewise.
Remove gimple_stmt_iterator * argument.
(vect_transform_stmt): Adjust.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/tree-vect-loop.cc | 12 | ||||
-rw-r--r-- | gcc/tree-vect-slp.cc | 8 | ||||
-rw-r--r-- | gcc/tree-vect-stmts.cc | 14 | ||||
-rw-r--r-- | gcc/tree-vectorizer.h | 3 |
4 files changed, 16 insertions, 21 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 00058c3..bf8d677 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -2061,8 +2061,7 @@ vect_analyze_loop_operations (loop_vec_info loop_vinfo) if (ok && STMT_VINFO_LIVE_P (stmt_info) && !PURE_SLP_STMT (stmt_info)) - ok = vectorizable_live_operation (loop_vinfo, - stmt_info, NULL, NULL, NULL, + ok = vectorizable_live_operation (loop_vinfo, stmt_info, NULL, NULL, -1, false, &cost_vec); if (!ok) @@ -10185,9 +10184,7 @@ vectorizable_induction (loop_vec_info loop_vinfo, it can be supported. */ bool -vectorizable_live_operation (vec_info *vinfo, - stmt_vec_info stmt_info, - gimple_stmt_iterator *gsi, +vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, slp_tree slp_node, slp_instance slp_node_instance, int slp_index, bool vec_stmt_p, stmt_vector_for_cost *cost_vec) @@ -10393,9 +10390,12 @@ vectorizable_live_operation (vec_info *vinfo, the loop mask for the final iteration. */ gcc_assert (ncopies == 1 && !slp_node); tree scalar_type = TREE_TYPE (STMT_VINFO_VECTYPE (stmt_info)); - tree mask = vect_get_loop_mask (loop_vinfo, gsi, + gimple_seq tem = NULL; + gimple_stmt_iterator gsi = gsi_last (tem); + tree mask = vect_get_loop_mask (loop_vinfo, &gsi, &LOOP_VINFO_MASKS (loop_vinfo), 1, vectype, 0); + gimple_seq_add_seq (&stmts, tem); tree scalar_res = gimple_build (&stmts, CFN_EXTRACT_LAST, scalar_type, mask, vec_lhs_phi); diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 070ab3f..f029215 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -6012,8 +6012,7 @@ vect_slp_analyze_node_operations_1 (vec_info *vinfo, slp_tree node, FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, slp_stmt_info) { if (STMT_VINFO_LIVE_P (slp_stmt_info) - && !vectorizable_live_operation (vinfo, - slp_stmt_info, NULL, node, + && !vectorizable_live_operation (vinfo, slp_stmt_info, node, node_instance, i, false, cost_vec)) return false; @@ -6330,7 +6329,7 @@ vect_bb_slp_mark_live_stmts (bb_vec_info bb_vinfo, slp_tree node, { STMT_VINFO_LIVE_P (stmt_info) = true; if (vectorizable_live_operation (bb_vinfo, stmt_info, - NULL, node, instance, i, + node, instance, i, false, cost_vec)) /* ??? So we know we can vectorize the live stmt from one SLP node. If we cannot do so from all @@ -9030,8 +9029,7 @@ vect_schedule_slp_node (vec_info *vinfo, FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (node), i, slp_stmt_info) if (STMT_VINFO_LIVE_P (slp_stmt_info)) { - done = vectorizable_live_operation (vinfo, - slp_stmt_info, &si, node, + done = vectorizable_live_operation (vinfo, slp_stmt_info, node, instance, i, true, NULL); gcc_assert (done); } diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 76b1c83..398fbe9 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -12011,11 +12011,10 @@ vectorizable_comparison (vec_info *vinfo, /* If SLP_NODE is nonnull, return true if vectorizable_live_operation can handle all live statements in the node. Otherwise return true if STMT_INFO is not live or if vectorizable_live_operation can handle it. - GSI and VEC_STMT_P are as for vectorizable_live_operation. */ + VEC_STMT_P is as for vectorizable_live_operation. */ static bool -can_vectorize_live_stmts (vec_info *vinfo, - stmt_vec_info stmt_info, gimple_stmt_iterator *gsi, +can_vectorize_live_stmts (vec_info *vinfo, stmt_vec_info stmt_info, slp_tree slp_node, slp_instance slp_node_instance, bool vec_stmt_p, stmt_vector_for_cost *cost_vec) @@ -12027,15 +12026,14 @@ can_vectorize_live_stmts (vec_info *vinfo, FOR_EACH_VEC_ELT (SLP_TREE_SCALAR_STMTS (slp_node), i, slp_stmt_info) { if (STMT_VINFO_LIVE_P (slp_stmt_info) - && !vectorizable_live_operation (vinfo, - slp_stmt_info, gsi, slp_node, + && !vectorizable_live_operation (vinfo, slp_stmt_info, slp_node, slp_node_instance, i, vec_stmt_p, cost_vec)) return false; } } else if (STMT_VINFO_LIVE_P (stmt_info) - && !vectorizable_live_operation (vinfo, stmt_info, gsi, + && !vectorizable_live_operation (vinfo, stmt_info, slp_node, slp_node_instance, -1, vec_stmt_p, cost_vec)) return false; @@ -12270,7 +12268,7 @@ vect_analyze_stmt (vec_info *vinfo, && STMT_VINFO_TYPE (stmt_info) != reduc_vec_info_type && STMT_VINFO_TYPE (stmt_info) != lc_phi_info_type && !can_vectorize_live_stmts (as_a <loop_vec_info> (vinfo), - stmt_info, NULL, node, node_instance, + stmt_info, node, node_instance, false, cost_vec)) return opt_result::failure_at (stmt_info->stmt, "not vectorized:" @@ -12428,7 +12426,7 @@ vect_transform_stmt (vec_info *vinfo, { /* Handle stmts whose DEF is used outside the loop-nest that is being vectorized. */ - done = can_vectorize_live_stmts (vinfo, stmt_info, gsi, slp_node, + done = can_vectorize_live_stmts (vinfo, stmt_info, slp_node, slp_node_instance, true, NULL); gcc_assert (done); } diff --git a/gcc/tree-vectorizer.h b/gcc/tree-vectorizer.h index dea29a7..5987a32 100644 --- a/gcc/tree-vectorizer.h +++ b/gcc/tree-vectorizer.h @@ -2362,8 +2362,7 @@ extern opt_result vect_analyze_loop_form (class loop *, vect_loop_form_info *); extern loop_vec_info vect_create_loop_vinfo (class loop *, vec_info_shared *, const vect_loop_form_info *, loop_vec_info = nullptr); -extern bool vectorizable_live_operation (vec_info *, - stmt_vec_info, gimple_stmt_iterator *, +extern bool vectorizable_live_operation (vec_info *, stmt_vec_info, slp_tree, slp_instance, int, bool, stmt_vector_for_cost *); extern bool vectorizable_reduction (loop_vec_info, stmt_vec_info, |