http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52287
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> 2012-02-23 15:52:23 UTC --- I don't think INSN_UID is right for that, I think you want to preserve the original order of debug insns in that case, and INSN_UID can jump up and down. So what about if (MAY_HAVE_DEBUG_INSNS) { /* Schedule debug insns as early as possible. */ if (DEBUG_INSN (tmp)) { if (DEBUG_INSN (tmp2)) return INSN_LUID (tmp) - INSN_LUID (tmp2); return -1; } else if (DEBUG_INSN (tmp2)) return 1; } ?