From 6d71672db616f6d3f5462028d6476a28610f42b5 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 27 Jan 2015 10:19:30 +0100 Subject: re PR rtl-optimization/61058 (ICE: RTL check: expected elt 3 type 'B', have '0' (rtx barrier) in distance_agu_use_in_bb, at config/i386/i386.c:16740 with __builtin_unreachable()) PR rtl-optimization/61058 * jump.c (cleanup_barriers): Update basic block boundaries if BLOCK_FOR_INSN is non-NULL on PREV. * gcc.dg/pr61058.c: New test. From-SVN: r220155 --- gcc/jump.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) (limited to 'gcc/jump.c') diff --git a/gcc/jump.c b/gcc/jump.c index 3b8c91e..34b3b7b 100644 --- a/gcc/jump.c +++ b/gcc/jump.c @@ -168,7 +168,30 @@ cleanup_barriers (void) if (BARRIER_P (prev)) delete_insn (insn); else if (prev != PREV_INSN (insn)) - reorder_insns_nobb (insn, insn, prev); + { + basic_block bb = BLOCK_FOR_INSN (prev); + rtx_insn *end = PREV_INSN (insn); + reorder_insns_nobb (insn, insn, prev); + if (bb) + { + /* If the backend called in machine reorg compute_bb_for_insn + and didn't free_bb_for_insn again, preserve basic block + boundaries. Move the end of basic block to PREV since + it is followed by a barrier now, and clear BLOCK_FOR_INSN + on the following notes. + ??? Maybe the proper solution for the targets that have + cfg around after machine reorg is not to run cleanup_barriers + pass at all. */ + BB_END (bb) = prev; + do + { + prev = NEXT_INSN (prev); + if (prev != insn && BLOCK_FOR_INSN (prev) == bb) + BLOCK_FOR_INSN (prev) = NULL; + } + while (prev != end); + } + } } } return 0; -- cgit v1.1