[gcc r17-2825] Deal with all vector defs in vectorizable_live_operation
Richard Biener via Gcc-cvs <[email protected]> Thu, 30 Jul 2026 13:51:07 +0000 (GMT)
| Newsgroups | gmane.comp.gcc.cvs |
|---|---|
| Message-ID | <[email protected]> |
https://gcc.gnu.org/g:8b41dfcf9b39b7c4be41ab4040ac85c588f7f373 commit r17-2825-g8b41dfcf9b39b7c4be41ab4040ac85c588f7f373 Author: Richard Biener <[email protected]> Date: Thu Jul 30 14:27:59 2026 +0200 Deal with all vector defs in vectorizable_live_operation After no longer requiring copies for existing vector defs we have to deal with them. vectorizable_live_operation computes an insert location based on them, so insert on region entry if required. * tree-vect-loop.cc (vectorizable_live_operation): Insert on entry when the vector def is a default def or a constant. Diff: --- gcc/tree-vect-loop.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 8cda9da7f1ac..31de29c036be 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -10366,7 +10366,6 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, /* Get the correct slp vectorized stmt. */ tree vec_lhs = SLP_TREE_VEC_DEFS (slp_node)[vec_entry]; - gimple *vec_stmt = SSA_NAME_DEF_STMT (vec_lhs); /* In case we need to early break vectorize also get the first stmt. */ tree vec_lhs0 = SLP_TREE_VEC_DEFS (slp_node)[0]; @@ -10454,7 +10453,10 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, if (TREE_CODE (new_tree) == SSA_NAME && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (lhs)) SSA_NAME_OCCURS_IN_ABNORMAL_PHI (new_tree) = 1; - if (is_a <gphi *> (vec_stmt)) + gimple *vec_stmt = SSA_NAME_DEF_STMT (vec_lhs); + if (TREE_CODE (vec_lhs) != SSA_NAME || SSA_NAME_IS_DEFAULT_DEF (vec_lhs)) + vinfo->insert_seq_on_entry (stmt_info, stmts); + else if (is_a <gphi *> (vec_stmt)) { gimple_stmt_iterator si = gsi_after_labels (gimple_bb (vec_stmt)); gsi_insert_seq_before (&si, stmts, GSI_SAME_STMT); @@ -10505,6 +10507,8 @@ vectorizable_live_operation (vec_info *vinfo, stmt_vec_info stmt_info, edge e; if (TREE_CODE (new_tree) == SSA_NAME && !SSA_NAME_IS_DEFAULT_DEF (new_tree) + && TREE_CODE (vec_lhs) == SSA_NAME + && !SSA_NAME_IS_DEFAULT_DEF (vec_lhs) && (gimple_bb (use_stmt)->loop_father != gimple_bb (vec_stmt)->loop_father) /* But a replacement in a LC PHI is OK. This happens