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). Bootstrapped and tested on x86_64-unknown-linux-gnu, cross-tested aarch64-linux-gnu, pushed. * 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. --- 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 80f2bb476b4..f3159df3725 100644 --- a/gcc/tree-vect-stmts.cc +++ b/gcc/tree-vect-stmts.cc @@ -12525,13 +12525,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)); } @@ -12599,8 +12601,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:" @@ -12644,8 +12644,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)) { @@ -12775,8 +12777,6 @@ vect_transform_stmt (vec_info *vinfo, gcc_assert (done); } - STMT_VINFO_VECTYPE (stmt_info) = saved_vectype; - return is_store; } -- 2.43.0