http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56131
--- Comment #5 from vries at gcc dot gnu.org 2013-01-29 19:34:08 UTC --- A more structured version of the patch: ... Index: cfgrtl.c =================================================================== --- cfgrtl.c (revision 195240) +++ cfgrtl.c (working copy) @@ -135,7 +135,7 @@ delete_insn (rtx insn) if (! can_delete_label_p (insn)) { const char *name = LABEL_NAME (insn); - basic_block bb = BLOCK_FOR_INSN (insn); + basic_block bb = NULL, label_bb = BLOCK_FOR_INSN (insn); rtx bb_note = NEXT_INSN (insn); really_delete = false; @@ -143,8 +143,17 @@ delete_insn (rtx insn) NOTE_KIND (insn) = NOTE_INSN_DELETED_LABEL; NOTE_DELETED_LABEL_NAME (insn) = name; - if (bb_note != NULL_RTX && NOTE_INSN_BASIC_BLOCK_P (bb_note) - && BLOCK_FOR_INSN (bb_note) == bb) + if (bb_note != NULL_RTX + && NOTE_INSN_BASIC_BLOCK_P (bb_note)) + bb = NOTE_BASIC_BLOCK (bb_note); + + /* If the note following the label starts a basic block, and the + label is a member of the same basic block, interchange the two. + If the label is not marked with a bb, assume it's the same bb. */ + */ + if (bb != NULL + && (bb == label_bb + || label_bb == NULL)) { reorder_insns_nobb (insn, insn, bb_note); BB_HEAD (bb) = bb_note; ... I'll try to bootstrap this patch on x86_64 coming weekend when I'll be back home. I've also asked for access to the gcc compile farm to be able to test this on a sparc machine.