diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2018-07-31 14:22:05 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2018-07-31 14:22:05 +0000 |
commit | e1bd72966309ac459a55e2bc64ad355272d402f5 (patch) | |
tree | 61ce73a63a79b56f77a39ccb07e013a49b8732aa /gcc/tree-vect-loop.c | |
parent | fef96d8e2a370e826acdf914d51c88aa2657340a (diff) | |
download | gcc-e1bd72966309ac459a55e2bc64ad355272d402f5.zip gcc-e1bd72966309ac459a55e2bc64ad355272d402f5.tar.gz gcc-e1bd72966309ac459a55e2bc64ad355272d402f5.tar.bz2 |
[12/46] Make vect_finish_stmt_generation return a stmt_vec_info
This patch makes vect_finish_replace_stmt and vect_finish_stmt_generation
return the stmt_vec_info for the vectorised statement, so that the caller
doesn't need a separate vinfo_for_stmt to get at it.
This involved changing the structure of the statement-generating loops
so that they use narrow scopes for the vectorised gimple statements
and use the existing (wider) scopes for the associated stmt_vec_infos.
This helps with gimple stmt->stmt_vec_info changes further down the line.
The way we do this generation is another area ripe for clean-up,
but that's too much of a rabbit-hole for this series.
2018-07-31 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-vectorizer.h (vect_finish_replace_stmt): Return a stmt_vec_info
(vect_finish_stmt_generation): Likewise.
* tree-vect-stmts.c (vect_finish_stmt_generation_1): Likewise.
(vect_finish_replace_stmt, vect_finish_stmt_generation): Likewise.
(vect_build_gather_load_calls): Use the return value of the above
functions instead of a separate call to vinfo_for_stmt. Use narrow
scopes for the input gimple stmt and wider scopes for the associated
stmt_vec_info. Use vec_info::lookup_def when setting these
stmt_vec_infos from an SSA_NAME definition.
(vectorizable_bswap, vectorizable_call, vectorizable_simd_clone_call)
(vect_create_vectorized_demotion_stmts, vectorizable_conversion)
(vectorizable_assignment, vectorizable_shift, vectorizable_operation)
(vectorizable_store, vectorizable_load, vectorizable_condition)
(vectorizable_comparison): Likewise.
* tree-vect-loop.c (vectorize_fold_left_reduction): Likewise.
(vectorizable_reduction): Likewise.
From-SVN: r263127
Diffstat (limited to 'gcc/tree-vect-loop.c')
-rw-r--r-- | gcc/tree-vect-loop.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/gcc/tree-vect-loop.c b/gcc/tree-vect-loop.c index 1f8847f..ff4a8cf 100644 --- a/gcc/tree-vect-loop.c +++ b/gcc/tree-vect-loop.c @@ -5861,7 +5861,7 @@ vectorize_fold_left_reduction (gimple *stmt, gimple_stmt_iterator *gsi, loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_info); struct loop *loop = LOOP_VINFO_LOOP (loop_vinfo); tree vectype_out = STMT_VINFO_VECTYPE (stmt_info); - gimple *new_stmt = NULL; + stmt_vec_info new_stmt_info = NULL; int ncopies; if (slp_node) @@ -5917,6 +5917,7 @@ vectorize_fold_left_reduction (gimple *stmt, gimple_stmt_iterator *gsi, tree def0; FOR_EACH_VEC_ELT (vec_oprnds0, i, def0) { + gimple *new_stmt; tree mask = NULL_TREE; if (LOOP_VINFO_FULLY_MASKED_P (loop_vinfo)) mask = vect_get_loop_mask (gsi, masks, vec_num, vectype_in, i); @@ -5965,17 +5966,18 @@ vectorize_fold_left_reduction (gimple *stmt, gimple_stmt_iterator *gsi, if (i == vec_num - 1) { gimple_set_lhs (new_stmt, scalar_dest); - vect_finish_replace_stmt (scalar_dest_def, new_stmt); + new_stmt_info = vect_finish_replace_stmt (scalar_dest_def, new_stmt); } else - vect_finish_stmt_generation (scalar_dest_def, new_stmt, gsi); + new_stmt_info = vect_finish_stmt_generation (scalar_dest_def, + new_stmt, gsi); if (slp_node) - SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt); + SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt_info); } if (!slp_node) - STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; + STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt_info; return true; } @@ -6102,7 +6104,7 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, int epilog_copies; stmt_vec_info prev_stmt_info, prev_phi_info; bool single_defuse_cycle = false; - gimple *new_stmt = NULL; + stmt_vec_info new_stmt_info = NULL; int j; tree ops[3]; enum vect_def_type dts[3]; @@ -7130,19 +7132,19 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, gcc_assert (reduc_index != -1 || ! single_defuse_cycle); if (single_defuse_cycle && reduc_index == 0) - vec_oprnds0[0] = gimple_get_lhs (new_stmt); + vec_oprnds0[0] = gimple_get_lhs (new_stmt_info->stmt); else vec_oprnds0[0] = vect_get_vec_def_for_stmt_copy (dts[0], vec_oprnds0[0]); if (single_defuse_cycle && reduc_index == 1) - vec_oprnds1[0] = gimple_get_lhs (new_stmt); + vec_oprnds1[0] = gimple_get_lhs (new_stmt_info->stmt); else vec_oprnds1[0] = vect_get_vec_def_for_stmt_copy (dts[1], vec_oprnds1[0]); if (op_type == ternary_op) { if (single_defuse_cycle && reduc_index == 2) - vec_oprnds2[0] = gimple_get_lhs (new_stmt); + vec_oprnds2[0] = gimple_get_lhs (new_stmt_info->stmt); else vec_oprnds2[0] = vect_get_vec_def_for_stmt_copy (dts[2], vec_oprnds2[0]); @@ -7169,23 +7171,24 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, new_temp = make_ssa_name (vec_dest, call); gimple_call_set_lhs (call, new_temp); gimple_call_set_nothrow (call, true); - new_stmt = call; + new_stmt_info = vect_finish_stmt_generation (stmt, call, gsi); } else { if (op_type == ternary_op) vop[2] = vec_oprnds2[i]; - new_stmt = gimple_build_assign (vec_dest, code, - vop[0], vop[1], vop[2]); + gassign *new_stmt = gimple_build_assign (vec_dest, code, + vop[0], vop[1], vop[2]); new_temp = make_ssa_name (vec_dest, new_stmt); gimple_assign_set_lhs (new_stmt, new_temp); + new_stmt_info + = vect_finish_stmt_generation (stmt, new_stmt, gsi); } - vect_finish_stmt_generation (stmt, new_stmt, gsi); if (slp_node) { - SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt); + SLP_TREE_VEC_STMTS (slp_node).quick_push (new_stmt_info); vect_defs.quick_push (new_temp); } else @@ -7196,11 +7199,11 @@ vectorizable_reduction (gimple *stmt, gimple_stmt_iterator *gsi, continue; if (j == 0) - STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt; + STMT_VINFO_VEC_STMT (stmt_info) = *vec_stmt = new_stmt_info; else - STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt; + STMT_VINFO_RELATED_STMT (prev_stmt_info) = new_stmt_info; - prev_stmt_info = vinfo_for_stmt (new_stmt); + prev_stmt_info = new_stmt_info; } /* Finalize the reduction-phi (set its arguments) and create the |