https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94618
--- Comment #8 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Though, a slight advantage of the patch as is is that it will do any insn walk only if two conditions are met, BB_END is a DEBUG_INSN and insn is followed by a DEBUG_INSN. My thoughs were that there could be a large bb with hundreds of DEBUG_INSNs at the end and if we e.g. started deleting insn from the start, even if they aren't really followed by any DEBUG_INSNs, we'd still walk all of them each time.