https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86991
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> --- Hmm. To me it looks like the assert that triggers: if (orig_stmt_info) gcc_assert (tmp == orig_stmt_info || REDUC_GROUP_FIRST_ELEMENT (tmp) == orig_stmt_info); else /* We changed STMT to be the first stmt in reduction chain, hence we check that in this case the first element in the chain is STMT. */ gcc_assert (tmp == stmt_info || REDUC_GROUP_FIRST_ELEMENT (tmp) == stmt_info); doesn't work this way for SLP reductions with a reduction path since tmp (STMT_VINFO_REDUC_DEF) is obviously different from stmt_info (the first non-PHI). But what the vectorizer tries to do makes sense. Maybe test coverage was too low to uncover this up until now. It looks like the testcase relies on some unfortunate invariant code in the IL. Did you have a testcase that computed sth more meaningful?