https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69014
--- Comment #8 from ktkachov at gcc dot gnu.org --- I've attached the CFG before and after the doloop pass, which I think introduces the badness. In loop3 the loop header exit condition is transformed but it disregards the fact that the CC reg is also being used in another basic block inside the loop (insn 12). But since the CC reg was clobbered by the doloop_end pattern, its use in insn 12 that expects the result of the comparison from insn 19 is now bogus. I think the solution here is to reject the doloop transformation if there is any use of the CC reg after the loop exit basic block