https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111387
--- Comment #2 from Richard Biener <rguenth at gcc dot gnu.org> --- The main issue is that when BB SLP splits the function when we already entered a cycle we have to go back and split at the containing cycles (recursively) because otherwise we can end up seeing "externals" from backedges. This particular testcase can be fixed by iterating over blocks in a better way but the general issue remains that the defensive code in vect_get_and_check_slp_defs relies on dominance info which doesn't work well for irreducible regions we are faced with here. The testcase also shows the recent honoring of ->dont_vectorize pessimizes the cases where we applied if-conversion for loop vectorization since that sets ->dont_vectorize on the original loop and that never gets cleared.