This is the mail archive of the
mailing list for the GCC project.
Re: [patch] tree-cfg.c: Speed up tree_try_redirect_by_replacing_jump.
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Kazu Hirata <kazu at cs dot umass dot edu>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 25 Nov 2004 13:24:44 +0100
- Subject: Re: [patch] tree-cfg.c: Speed up tree_try_redirect_by_replacing_jump.
- References: <email@example.com>
> Attached is a patch to speed up tree_try_redirect_by_replacing_jump.
> tree_try_redirect_by_replacing_jump tries to redirect a conditional
> jump like COND_EXPR or SWITCH_PEXR by replacing it with an
> unconditonal jump, which is actually represented implicitly.
> Note that we can remove a conditoinal jump only when we have exactly
> two outgoing edges. If we have exactly one outgoing edge, we don't
> have any COND_EXPR or SWITCH_EXPR in the first place. If we have
> three or more outgoing edges, redirecting one of them will give you at
> least two unique edges, meaning that we cannot still remove
> If we have exactly two outgoing edges, then the edge that we are not
> redirecting must have the same destination as the one we want to
> redirect an edge to.
> The patch implements the idea above.
> Note that the original implementation of the check "leaks" a case with
> only one outgoing edge, in which case TMP is NULL. In other words,
> "if (tmp)" cannot catch this case, letting the control fall through
> even though we know we have to return NULL at the end.
> Here is a timing in seconds for three runs of "./cc1 -quiet -O2
> -fomit-frame-pointer -o /dev/null insn-attrtab.i".
> original patched
> real: 135.841 134.840 (0.736% down)
> user: 133.496 132.788 (0.530% down)
> Tested on i686-pc-linux-gnu. OK to apply?
> I could do the same on cfgrtl.c:try_redirect_by_replacing_jump, but
> doing so actually generated different assembly code, so I didn't mix
> that into this patch.
At least in rtl world, the cfg_cleanup depends on fact that
try_redirect_by_replacing_jump will clean up jumps that happens to go
into same destination in both brances (ie we have one edge but still
condjump or switch)