http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61058
Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- I think the buggy pass here is: static unsigned int cleanup_barriers (void) { rtx insn, next, prev; for (insn = get_insns (); insn; insn = next) { next = NEXT_INSN (insn); if (BARRIER_P (insn)) { prev = prev_nonnote_insn (insn); if (!prev) continue; if (BARRIER_P (prev)) delete_insn (insn); else if (prev != PREV_INSN (insn)) reorder_insns_nobb (insn, insn, prev); } } return 0; } At the start of that pass we have: (note 3 1 9 2 [bb 2] NOTE_INSN_BASIC_BLOCK) (insn/f 9 3 10 2 (set (mem:DI (pre_dec:DI (reg/f:DI 7 sp)) [0 S8 A8]) (reg/f:DI 6 bp)) pr61058.c:3 -1 (nil)) (insn/f 10 9 11 2 (set (reg/f:DI 6 bp) (reg/f:DI 7 sp)) pr61058.c:3 -1 (nil)) (note 11 10 2 2 NOTE_INSN_PROLOGUE_END) (note 2 11 5 2 NOTE_INSN_FUNCTION_BEG) (barrier 5 2 8) (note 8 5 0 NOTE_INSN_DELETED) where BB_HEAD (bb2) is note 3 and BB_END (bb2) is note 2, note 8 has been added by LRA (but reload does that too AFAIK), both barrier and note are outside of the bb 2. Now, the above reorders the barrier after insn 10, making it part of bb2 because BB_END (bb2) isn't adjusted. So, either cleanup_barriers should not move anything here (e.g. because prev doesn't satisfy control_flow_insn_p (prev)), and/or, of it decides to move something, it has to take care of adjusting the affected basic blocks (but how? Would we keep the two notes (11 and 2) without basic block). Do we need the cleanup_barriers pass at all these days?