diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2fc1859b5c0..1613d2f35ec 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2003-10-31 Josef Zlomek + + PR/11640 + * cfgrtl.c (try_redirect_by_replacing_jump): Move jump + immediatelly before BARRIER. + 2003-10-31 Kelley Cook * Makefile.in (STRICT2_WARN): Add -Wold-style-definition. diff --git a/gcc/cfgrtl.c b/gcc/cfgrtl.c index f383438e26b..7354c73c7fb 100644 --- a/gcc/cfgrtl.c +++ b/gcc/cfgrtl.c @@ -793,6 +793,30 @@ try_redirect_by_replacing_jump (edge e, basic_block target, bool in_cfglayout) barrier = next_nonnote_insn (src->end); if (!barrier || GET_CODE (barrier) != BARRIER) emit_barrier_after (src->end); + else + { + if (barrier != NEXT_INSN (src->end)) + { + /* Move the jump before barrier so that the notes + which originally were or were created before jump table are + inside the basic block. */ + rtx new_insn = src->end; + rtx tmp; + + for (tmp = NEXT_INSN (src->end); tmp != barrier; + tmp = NEXT_INSN (tmp)) + set_block_for_insn (tmp, src); + + NEXT_INSN (PREV_INSN (new_insn)) = NEXT_INSN (new_insn); + PREV_INSN (NEXT_INSN (new_insn)) = PREV_INSN (new_insn); + + NEXT_INSN (new_insn) = barrier; + NEXT_INSN (PREV_INSN (barrier)) = new_insn; + + PREV_INSN (new_insn) = PREV_INSN (barrier); + PREV_INSN (barrier) = new_insn; + } + } } /* Keep only one edge out and set proper flags. */