https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111387
--- Comment #6 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The releases/gcc-13 branch has been updated by Richard Biener <[email protected]>: https://gcc.gnu.org/g:1990e6544b9f0db39c470b999c32d2ecdd419f46 commit r13-10355-g1990e6544b9f0db39c470b999c32d2ecdd419f46 Author: Richard Biener <[email protected]> Date: Wed Sep 13 11:04:31 2023 +0200 tree-optimization/111387 - BB SLP and irreducible regions When we split an irreducible region for BB vectorization analysis the defensive handling of external backedge defs in vect_get_and_check_slp_defs doesn't work since that relies on dominance info to identify a backedge. The testcase also shows we are iterating over the function in a sub-optimal way which is why we split the irreducible region in the first place. The fix is to mark backedges and use EDGE_DFS_BACK to identify them. PR tree-optimization/111387 * tree-vect-slp.cc (vect_get_and_check_slp_defs): Check EDGE_DFS_BACK when doing BB vectorization. (vect_slp_function): Mark backedges. * gcc.dg/torture/pr111387.c: New testcase.
