This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: fix tablejump elimination wrt crossjumping
- From: Jan Hubicka <jh at suse dot cz>
- To: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org
- Date: Thu, 17 Apr 2003 18:27:53 +0200
- Subject: Re: fix tablejump elimination wrt crossjumping
- References: <20030323204643.GA11139@redhat.com>
> Following
>
> Fri May 3 11:12:24 CEST 2002 Jan Hubicka <jh at suse dot cz>
>
> * cfgcleanup.c (try_optimize_cfg): Call merge_block only when
> jump is simplejump.
>
> Thu May 2 19:50:04 CEST 2002 Jan Hubicka <jh at suse dot cz>
>
> * cfgrtl.c (try_redirect_by_replacing_jump): Do not kill computed
> jumps post reload.
> * toplev.c (rest_of_compilation): Revert Richard's patch.
>
> we lost all ability to eliminate tablejump insns after reload.
I was aware of that but didn't find any other sollution, unforutnately..
>
> Index: cfgcleanup.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/cfgcleanup.c,v
> retrieving revision 1.79
> diff -u -p -u -r1.79 cfgcleanup.c
> --- cfgcleanup.c 23 Mar 2003 01:40:04 -0000 1.79
> +++ cfgcleanup.c 23 Mar 2003 20:38:16 -0000
> @@ -1791,7 +1791,9 @@ try_optimize_cfg (mode)
> /* If the jump insn has side effects,
> we can't kill the edge. */
> && (GET_CODE (b->end) != JUMP_INSN
> - || simplejump_p (b->end))
> + || (flow2_completed
> + ? simplejump_p (b->end)
> + : onlyjump_p (b->end)))
I don't think this is safe - it is possible that the computation
temporary has been spilled to the stack and we don't DCE dead stores
reliably.
Honza
> && (next = merge_blocks (s, b, c, mode)))
> {
> b = next;
> Index: cfgrtl.c
> ===================================================================
> RCS file: /cvs/gcc/gcc/gcc/cfgrtl.c,v
> retrieving revision 1.67
> diff -u -p -u -r1.67 cfgrtl.c
> --- cfgrtl.c 5 Mar 2003 22:05:18 -0000 1.67
> +++ cfgrtl.c 23 Mar 2003 20:38:16 -0000
> @@ -684,7 +684,7 @@ try_redirect_by_replacing_jump (e, targe
>
> if (tmp || !onlyjump_p (insn))
> return false;
> - if (reload_completed && JUMP_LABEL (insn)
> + if (flow2_completed && JUMP_LABEL (insn)
> && (table = NEXT_INSN (JUMP_LABEL (insn))) != NULL_RTX
> && GET_CODE (table) == JUMP_INSN
> && (GET_CODE (PATTERN (table)) == ADDR_VEC