diff options
author | Richard Biener <rguenther@suse.de> | 2023-12-20 13:18:51 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2023-12-20 14:43:36 +0100 |
commit | a8f0278ade1353e3e6389aa7a00525b6e9b723ab (patch) | |
tree | 2c3726617fa3dbc0f5c4652451099dbb2933061c | |
parent | e61c51009145bab05cdc00e06a7dbc4209cb580e (diff) | |
download | gcc-a8f0278ade1353e3e6389aa7a00525b6e9b723ab.zip gcc-a8f0278ade1353e3e6389aa7a00525b6e9b723ab.tar.gz gcc-a8f0278ade1353e3e6389aa7a00525b6e9b723ab.tar.bz2 |
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.
-rw-r--r-- | gcc/tree-vect-slp.cc | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index a82fca4..1a357cb 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; |