http://gcc.gnu.org/bugzilla/show_bug.cgi?id=61058
--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> --- On the other side, pass_cleanup_barriers is performed after pass_free_cfg, so making it unconditionally cfg-aware is not going to work, it is just that i386 (as well as few other targets) calls compute_bb_for_insn in its mach_reorg pass and doesn't free_bb_for_insn afterwards. So perhaps do nothing if BLOCK_FOR_INSN (prev), or call reorder_insns instead of reorder_insns_nobb if BLOCK_FOR_INSN (prev)? Though, calling reorder_insns there doesn't seem to work either, it isn't prepared to handle the case of moving a BARRIER into the middle of some bb.