From: Richard Biener Date: Wed, 20 Dec 2023 12:18:51 +0000 (+0100) Subject: Improve DCE of dead parts of a permute chain X-Git-Tag: basepoints/gcc-15~3391 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=a8f0278ade1353e3e6389aa7a00525b6e9b723ab;p=thirdparty%2Fgcc.git Improve DCE of dead parts of a permute chain gcc.dg/vect/bb-slp-pr78205.c is reported to have regressed with the PR113073 change and in the end it's due to the DCE performed by vect_transform_slp_perm_load_1 being imperfect. The following enhances it to also cover the CTOR and VIEW_CONVERT operations that might be involved. * tree-vect-slp.cc (vect_transform_slp_perm_load_1): Also handle CTOR and VIEW_CONVERT up to the load when performing chain DCE. --- diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index a82fca451610..1a357cb7549a 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -8634,10 +8634,21 @@ vect_transform_slp_perm_load_1 (vec_info *vinfo, slp_tree node, for (unsigned i = 0; i < dr_chain.length (); ++i) if (!bitmap_bit_p (used_defs, i)) { - gimple *stmt = SSA_NAME_DEF_STMT (dr_chain[i]); - gimple_stmt_iterator rgsi = gsi_for_stmt (stmt); - gsi_remove (&rgsi, true); - release_defs (stmt); + tree def = dr_chain[i]; + do + { + gimple *stmt = SSA_NAME_DEF_STMT (def); + if (is_gimple_assign (stmt) + && (gimple_assign_rhs_code (stmt) == VIEW_CONVERT_EXPR + || gimple_assign_rhs_code (stmt) == CONSTRUCTOR)) + def = single_ssa_tree_operand (stmt, SSA_OP_USE); + else + def = NULL; + gimple_stmt_iterator rgsi = gsi_for_stmt (stmt); + gsi_remove (&rgsi, true); + release_defs (stmt); + } + while (def); } return true;