https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69224
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> --- It miscompiles gcc.dg/tree-ssa/pr23391.c and more (gcc.c-torture/execute/20000422-1.c is another example). Looks like latch vs. stmt execution issues to me as the affected stmts are only after the IV exit test and thus the dominance check doesn't work. So we'd want a header post-dominated by stmt check instead. But it isn't that easy as at the time we unroll this PRs testcase the IV exit test is in the loop header - it didn't have loop header copying applied. Which is probably the source of the whole issue. Indeed doing loop header copying before unrolling fixes the issue as well.