https://gcc.gnu.org/g:1786be14e94bf1a7806b9dc09186f021737f0227
commit r16-3159-g1786be14e94bf1a7806b9dc09186f021737f0227 Author: Richard Biener <rguent...@suse.de> Date: Mon Aug 11 11:22:47 2025 +0200 Do not set STMT_VINFO_VECTYPE for non-dataref stmts Now that all STMT_VINFO_VECTYPE uses from vectorizable_* have been pruged there's no longer a need to have STMT_VINFO_VECTYPE set. We still rely on it being present on data-ref stmts and there it can differ between different SLP instances when doing BB vectorization. The following removes the setting from vect_analyze_stmt and vect_transform_stmt. Note the following clears STMT_VINFO_VECTYPE from pattern stmts (the vector type should have moved to the SLP tree by this time). * tree-vect-stmts.cc (vect_analyze_stmt): Only set STMT_VINFO_VECTYPE for dataref SLP representatives. Clear it for others and do not restore the original value. (vect_transform_stmt): Likewise. Diff: --- gcc/tree-vect-stmts.cc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc index 26d5be518922..b14680e0d7c3 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -12515,13 +12515,15 @@ vect_analyze_stmt (vec_info *vinfo, gcc_unreachable (); } - tree saved_vectype = STMT_VINFO_VECTYPE (stmt_info); - STMT_VINFO_VECTYPE (stmt_info) = SLP_TREE_VECTYPE (node); + if (! STMT_VINFO_DATA_REF (stmt_info)) + STMT_VINFO_VECTYPE (stmt_info) = NULL_TREE; + else + STMT_VINFO_VECTYPE (stmt_info) = SLP_TREE_VECTYPE (node); if (STMT_VINFO_RELEVANT_P (stmt_info)) { gcall *call = dyn_cast <gcall *> (stmt_info->stmt); - gcc_assert (STMT_VINFO_VECTYPE (stmt_info) + gcc_assert (SLP_TREE_VECTYPE (node) || gimple_code (stmt_info->stmt) == GIMPLE_COND || (call && gimple_call_lhs (call) == NULL_TREE)); } @@ -12589,8 +12591,6 @@ vect_analyze_stmt (vec_info *vinfo, } - STMT_VINFO_VECTYPE (stmt_info) = saved_vectype; - if (!ok) return opt_result::failure_at (stmt_info->stmt, "not vectorized:" @@ -12634,8 +12634,10 @@ vect_transform_stmt (vec_info *vinfo, dump_printf_loc (MSG_NOTE, vect_location, "------>vectorizing statement: %G", stmt_info->stmt); - tree saved_vectype = STMT_VINFO_VECTYPE (stmt_info); - STMT_VINFO_VECTYPE (stmt_info) = SLP_TREE_VECTYPE (slp_node); + if (! STMT_VINFO_DATA_REF (stmt_info)) + STMT_VINFO_VECTYPE (stmt_info) = NULL_TREE; + else + STMT_VINFO_VECTYPE (stmt_info) = SLP_TREE_VECTYPE (slp_node); switch (SLP_TREE_TYPE (slp_node)) { @@ -12765,8 +12767,6 @@ vect_transform_stmt (vec_info *vinfo, gcc_assert (done); } - STMT_VINFO_VECTYPE (stmt_info) = saved_vectype; - return is_store; }