From f8d1529b85d65cec8c84f56b1b907f9d673697f2 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Mon, 2 Jul 2001 23:16:50 +0200 Subject: [PATCH] flow.c (try_redirect_by_replacing_jump): Remove cc0 setter. * flow.c (try_redirect_by_replacing_jump): Remove cc0 setter. * flow.c (forwarder_block_p): Fix for fallthru blocks. (try_redirect_by_replacing_jump): Update properly the count and frequency information. From-SVN: r43708 --- gcc/ChangeLog | 8 ++++++++ gcc/flow.c | 37 ++++++++++++++++++++++++++++--------- 2 files changed, 36 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 328753f1435..a83fdf51426 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +Mon Jul 2 23:14:00 CEST 2001 Jan Hubicka + + * flow.c (try_redirect_by_replacing_jump): Remove cc0 setter. + + * flow.c (forwarder_block_p): Fix for fallthru blocks. + (try_redirect_by_replacing_jump): Update properly the count + and frequency information. + Mon Jul 2 14:20:13 2001 Jeffrey A Law (law@cygnus.com) * toplev.c (dump_file_index): Move SSA dumps just after first diff --git a/gcc/flow.c b/gcc/flow.c index ab1bb7f12fa..391b4b45c11 100644 --- a/gcc/flow.c +++ b/gcc/flow.c @@ -1597,18 +1597,19 @@ static bool forwarder_block_p (bb) basic_block bb; { - rtx insn; + rtx insn = bb->head; if (bb == EXIT_BLOCK_PTR || bb == ENTRY_BLOCK_PTR || !bb->succ || bb->succ->succ_next) return false; - insn = next_active_insn (bb->head); - if (!insn) - return false; - if (GET_CODE (insn) == CODE_LABEL - || (GET_CODE (insn) == JUMP_INSN && onlyjump_p (insn))) - return true; - return false; + while (insn != bb->end) + { + if (active_insn_p (insn)) + return false; + insn = NEXT_INSN (insn); + } + return (!active_insn_p (insn) + || (GET_CODE (insn) == JUMP_INSN && onlyjump_p (insn))); } /* Return nonzero if we can reach target from src by falling trought. */ @@ -1699,6 +1700,8 @@ try_redirect_by_replacing_jump (e, target) e->flags = EDGE_FALLTHRU; else e->flags = 0; + e->probability = REG_BR_PROB_BASE; + e->count = src->count; /* Fixup barriers. */ barrier = next_nonnote_insn (insn); @@ -1707,6 +1710,20 @@ try_redirect_by_replacing_jump (e, target) else if (!fallthru && GET_CODE (barrier) != BARRIER) emit_barrier_after (insn); + /* In case we've zapped an conditional jump, we need to kill the cc0 + setter too if available. */ +#ifdef HAVE_cc0 + insn = src->end; + if (GET_CODE (insn) == JUMP_INSN) + insn = prev_nonnote_insn (insn); + if (sets_cc0_p (insn)) + { + if (insn == src->end) + src->end = PREV_INSN (insn); + flow_delete_insn (insn); + } +#endif + if (e->dest != target) redirect_edge_succ (e, target); return true; @@ -1766,7 +1783,7 @@ redirect_edge_and_branch (e, target) for (j = GET_NUM_ELEM (vec) - 1; j >= 0; --j) if (XEXP (RTVEC_ELT (vec, j), 0) == old_label) { - RTVEC_ELT (vec, j) = gen_rtx_LABEL_REF (VOIDmode, new_label); + RTVEC_ELT (vec, j) = gen_rtx_LABEL_REF (Pmode, new_label); --LABEL_NUSES (old_label); ++LABEL_NUSES (new_label); } @@ -1815,6 +1832,8 @@ redirect_edge_and_branch (e, target) if (s) { s->flags |= e->flags; + s->probability += e->probability; + s->count += e->count; remove_edge (e); } else -- 2.30.2