This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Hookize CFG debugging code
- From: Jan Hubicka <jh at suse dot cz>
- To: John David Anglin <dave at hiauly1 dot hia dot nrc dot ca>
- Cc: gcc-patches at gcc dot gnu dot org, jh at suse dot cz, rth at redhat dot com
- Date: Fri, 20 Jun 2003 19:16:17 +0200
- Subject: Re: Hookize CFG debugging code
- References: <200306201706.h5KH6MdV028700@hiauly1.hia.nrc.ca>
> I have determined that this patch
>
> Sun Jun 8 15:52:17 CEST 2003 Jan Hubicka <jh@suse.cz>
>
> * cfg.c (verify_flow_info): Move IL independent checks from cfgrtl here.
> (dump_bb): New based on old dump_bb in cfgrtl.c
> (debug_bb, debug_bb_n): Move the functions from cfgrtl.c here.
> * cfghooks.h (cfgh_verify_flow_info): Return status.
> * cfglayout.c (cfg_layout_finalize): Verify CFG correctness.
> * cfgrtl.c (debug_bb, debug_bb_n): Move to cfg.c
> (dump_bb): Remove generic parts.
> (rtl_verify_flow_info_1): Break out from rtl_verify_flow_info.
> (rtl_verify_flow_info): Only check things dependeing on linearized RTL.
>
> either causes or exposes a problem in the CFG for
> gcc.c-torture/compile/20030405-1.c on hppa-unknown-linux-gnu and
> hppa2.0w-hp-hpux11*. The test now fails on the trunk at -O2 and
> above with the following messages:
>
> /xxx/gnu/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/compile/20030405-1.c: In function `foo':
> /xxx/gnu/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/compile/20030405-1.c:58: error: Wrong amount of branch edges after conditional jump 17
> /xxx/gnu/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/compile/20030405-1.c:58: error: Wrong amount of branch edges after conditional jump 16
> /xxx/gnu/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/compile/20030405-1.c:58: error: Wrong amount of branch edges after conditional jump 13
> /xxx/gnu/gcc-3.4/gcc/gcc/testsuite/gcc.c-torture/compile/20030405-1.c:58: internal compiler error: verify_flow_info failed
>
> The test was for PR optimization/10024.
It looks like I've messed up the degenerated condjumps again.
Does this patch help?
I have to think deeper about some nice sollution to this problem.
Thanks,
Honza
Index: cfgrtl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
retrieving revision 1.81
diff -c -3 -p -r1.81 cfgrtl.c
*** cfgrtl.c 13 Jun 2003 22:56:09 -0000 1.81
--- cfgrtl.c 20 Jun 2003 17:14:42 -0000
*************** rtl_verify_flow_info_1 ()
*** 1765,1771 ****
FOR_EACH_BB_REVERSE (bb)
{
int n_fallthru = 0, n_eh = 0, n_call = 0, n_abnormal = 0, n_branch = 0;
! edge e;
rtx note;
if (INSN_P (bb->end)
--- 1765,1771 ----
FOR_EACH_BB_REVERSE (bb)
{
int n_fallthru = 0, n_eh = 0, n_call = 0, n_abnormal = 0, n_branch = 0;
! edge e, fallthru;
rtx note;
if (INSN_P (bb->end)
*************** rtl_verify_flow_info_1 ()
*** 1783,1789 ****
for (e = bb->succ; e; e = e->succ_next)
{
if (e->flags & EDGE_FALLTHRU)
! n_fallthru++;
if ((e->flags & ~(EDGE_DFS_BACK | EDGE_CAN_FALLTHRU | EDGE_IRREDUCIBLE_LOOP)) == 0)
n_branch++;
--- 1783,1789 ----
for (e = bb->succ; e; e = e->succ_next)
{
if (e->flags & EDGE_FALLTHRU)
! n_fallthru++, fallthru = e;
if ((e->flags & ~(EDGE_DFS_BACK | EDGE_CAN_FALLTHRU | EDGE_IRREDUCIBLE_LOOP)) == 0)
n_branch++;
*************** rtl_verify_flow_info_1 ()
*** 1822,1828 ****
err = 1;
}
if (n_branch != 1 && any_condjump_p (bb->end)
! && JUMP_LABEL (bb->end) != bb->next_bb->head)
{
error ("Wrong amount of branch edges after conditional jump %i", bb->index);
err = 1;
--- 1822,1828 ----
err = 1;
}
if (n_branch != 1 && any_condjump_p (bb->end)
! && JUMP_LABEL (bb->end) != fallthru->dest->head)
{
error ("Wrong amount of branch edges after conditional jump %i", bb->index);
err = 1;