This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
'fix' for 11350 causes bootstrap hang on Darwin
- From: Geoff Keating <geoffk at desire dot geoffk dot org>
- To: Jan Hubicka <jh at suse dot cz>
- Cc: gcc-regression at gcc dot gnu dot org, rth at redhat dot com, gcc-patches at gcc dot gnu dot org
- Date: Fri, 16 Jan 2004 22:23:40 -0800
- Subject: 'fix' for 11350 causes bootstrap hang on Darwin
Hi Jan,
This patch:
2004-01-16 Jan Hubicka <jh@suse.cz>
PR opt/11350
* cfgcleanup.c (try_optimize_cfg): Suppress tablejump removal
after reload.
* cfgrtl.c (rtl_can_merge_blocks, cfglayout_can_merge_blocks,
rtl_try_redirect_by_replacing_branch): Likewise.
causes bootstrap to hang on powerpc-darwin. The sequence is:
- try_optimize_cfg sees a branch like:
(jump_insn:HI 284 735 291 26 insn-attrtab.c:99366 (parallel [
(set (pc)
(reg:SI 66 ctr [198]))
(use (label_ref 285))
]) 515 {*rs6000.md:13804} (insn_list 735 (nil))
(expr_list:REG_DEAD (reg:SI 66 ctr [198])
(nil)))
which is the remains of a tablejump insn. It runs this chunk of code:
/* If B has a single outgoing edge, but uses a
non-trivial jump instruction without side-effects, we
can either delete the jump entirely, or replace it
with a simple unconditional jump. Use
redirect_edge_and_branch to do the dirty work. */
if (b->succ
&& ! b->succ->succ_next
&& b->succ->dest != EXIT_BLOCK_PTR
&& onlyjump_p (BB_END (b))
&& redirect_edge_and_branch (b->succ,
b->succ->dest))
{
update_forwarder_flag (b);
changed_here = true;
}
- rtl_redirect_edge_and_branch calls try_redirect_by_replacing_jump
- try_redirect_by_replacing_jump returns false because
this is (was) a tablejump and reload_completed is set
- rtl_redirect_edge_and_branch then enters this code:
2444 if (e->dest == dest)
2445 return true;
and since this is true (because it was called with 'dest' set to
b->succ->dest and 'e' set to b->succ), it'll return true without doing
anything.
I'm now testing this patch, and will commit if bootstrap & testrun
succeeds (I presume that a testcase was added for 11350, since
there's one in the bug report).
2004-01-16 Geoffrey Keating <geoffk@apple.com>
* cfgrtl.c (try_redirect_by_replacing_jump): Optimize tablejumps
even after reload, just don't remove the actual jump tables.
*** cfgrtl.c.~1.103.~ Fri Jan 16 19:07:19 2004
--- cfgrtl.c Fri Jan 16 22:15:03 2004
***************
*** 703,709 ****
if (tmp || !onlyjump_p (insn))
return false;
! if ((!optimize || reload_completed) && tablejump_p (insn, NULL, NULL))
return false;
/* Avoid removing branch with side effects. */
--- 703,709 ----
if (tmp || !onlyjump_p (insn))
return false;
! if ((!optimize || flow2_completed) && tablejump_p (insn, NULL, NULL))
return false;
/* Avoid removing branch with side effects. */
***************
*** 793,799 ****
/* Recognize a tablejump that we are converting to a
simple jump and remove its associated CODE_LABEL
and ADDR_VEC or ADDR_DIFF_VEC. */
! if (tablejump_p (insn, &label, &table))
delete_insn_chain (label, table);
barrier = next_nonnote_insn (BB_END (src));
--- 793,799 ----
/* Recognize a tablejump that we are converting to a
simple jump and remove its associated CODE_LABEL
and ADDR_VEC or ADDR_DIFF_VEC. */
! if (! reload_completed && tablejump_p (insn, &label, &table))
delete_insn_chain (label, table);
barrier = next_nonnote_insn (BB_END (src));
--
- Geoffrey Keating <geoffk@geoffk.org>