diff options
author | Richard Biener <rguenther@suse.de> | 2025-05-08 10:56:16 +0200 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2025-06-06 09:49:33 +0200 |
commit | 7da2b6ddf3a8371b585595231cddcb1ad0942ea4 (patch) | |
tree | e7c496912cb69a75cdbfad35ae8c6ba414723d93 | |
parent | 05ef04d644c1a460b3af266a7766001c93fe1a6a (diff) | |
download | gcc-7da2b6ddf3a8371b585595231cddcb1ad0942ea4.zip gcc-7da2b6ddf3a8371b585595231cddcb1ad0942ea4.tar.gz gcc-7da2b6ddf3a8371b585595231cddcb1ad0942ea4.tar.bz2 |
tree-optimization/116352 - amend previous fix
The previous fix restricted external vector builds to defs from
the same basic-block. That turns out too restrictive so we have
to mitigate the original issue in a different way which is
restricting it to the original case where all defs are in the
same basic-block.
PR tree-optimization/116352
* tree-vect-slp.cc (vect_build_slp_tree_2): When compressing
operands from a two-operator node make sure the resulting
operation does not mix defs from different basic-blocks.
(cherry picked from commit 1e8bd720b1a618a39e2a41eec05e935c32d295f3)
-rw-r--r-- | gcc/tree-vect-slp.cc | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index ed432a9..b5addd6 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -2616,13 +2616,14 @@ out: if (oprnds_info[0]->def_stmts[0] && is_a<gassign *> (oprnds_info[0]->def_stmts[0]->stmt)) code = gimple_assign_rhs_code (oprnds_info[0]->def_stmts[0]->stmt); + basic_block bb = nullptr; for (unsigned j = 0; j < group_size; ++j) { FOR_EACH_VEC_ELT (oprnds_info, i, oprnd_info) { stmt_vec_info stmt_info = oprnd_info->def_stmts[j]; - if (!stmt_info || !stmt_info->stmt + if (!stmt_info || !is_a<gassign *> (stmt_info->stmt) || gimple_assign_rhs_code (stmt_info->stmt) != code || skip_args[i]) @@ -2630,6 +2631,14 @@ out: success = false; break; } + /* Avoid mixing lanes with defs in different basic-blocks. */ + if (!bb) + bb = gimple_bb (vect_orig_stmt (stmt_info)->stmt); + else if (gimple_bb (vect_orig_stmt (stmt_info)->stmt) != bb) + { + success = false; + break; + } bool exists; unsigned &stmt_idx |