3.1 Patch Reverse: gcc/flow.c
Jeffrey Oldham
oldham@codesourcery.com
Thu Jul 5 14:01:00 GMT 2001
The attached patch (applied in reverse for gcc3.1) is Jan Hubicka's
flow.c patch of 02Jul. The patch causes the test regression for
i686-pc-linux-gnu gcc3.1:
FAIL: gcc.dg/wtr-label-1.c (test for excess errors)
He promised to fix it after his return
( http://gcc.gnu.org/ml/gcc-patches/2001-07/msg00270.html ). In the
meantime, we reverse it to avoid difficulties.
2001-07-05 Jeffrey Oldham <oldham@codesourcery.com>
* flow.c: Reverse Jan Hubicka's patch of 02July2001.
(try_redirect_by_replacing_jump): Reverse updating properly the
count and frequency information. Reverse removing cc0 setter.
(forwarder_block_p): Reverse fixing for fallthru blocks.
Applied to 3.1
Tested on i686-pc-linux-gnu
Approved by Richard Henderson (rth@redhat.com)
Thanks,
Jeffrey D. Oldham
oldham@codesourcery.com
Index: flow.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/flow.c,v
retrieving revision 1.411
retrieving revision 1.412
diff -c -p -r1.411 -r1.412
*** flow.c 2001/07/02 16:47:57 1.411
--- flow.c 2001/07/02 21:16:48 1.412
*************** static bool
*** 1597,1614 ****
forwarder_block_p (bb)
basic_block bb;
{
! rtx insn;
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;
}
/* Return nonzero if we can reach target from src by falling trought. */
--- 1597,1615 ----
forwarder_block_p (bb)
basic_block bb;
{
! rtx insn = bb->head;
if (bb == EXIT_BLOCK_PTR || bb == ENTRY_BLOCK_PTR
|| !bb->succ || bb->succ->succ_next)
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. */
*************** try_redirect_by_replacing_jump (e, targe
*** 1699,1704 ****
--- 1700,1707 ----
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);
*************** try_redirect_by_replacing_jump (e, targe
*** 1707,1712 ****
--- 1710,1729 ----
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;
*************** redirect_edge_and_branch (e, target)
*** 1766,1772 ****
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);
--LABEL_NUSES (old_label);
++LABEL_NUSES (new_label);
}
--- 1783,1789 ----
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 (Pmode, new_label);
--LABEL_NUSES (old_label);
++LABEL_NUSES (new_label);
}
*************** redirect_edge_and_branch (e, target)
*** 1815,1820 ****
--- 1832,1839 ----
if (s)
{
s->flags |= e->flags;
+ s->probability += e->probability;
+ s->count += e->count;
remove_edge (e);
}
else
More information about the Gcc-bugs
mailing list