This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: '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.

I actually read this patch backwards.  I am working on more correct
sollution.  i think cfgcleanup should simply use
try_redirect_by_replacing_jump instead of doing the trick of redirecting
to itself.

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]