This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: better redundant compare elimination
- To: John Carr <jfc at tiac dot net>
- Subject: Re: better redundant compare elimination
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Fri, 04 Sep 1998 03:06:47 -0600
- cc: egcs-patches at cygnus dot com
- Reply-To: law at cygnus dot com
In message <199809031102.HAA00669@jfc.tiac.net>you write:
>
> This patch eliminates redundant compares when a label is only reached
> from a jump by setting CC status according to the instruction preceding
> the branch.
Interesting idea.
> This has a very small effect on the code I tried it on. Is it worth
> installing?
Your call.
> Any other comments?
You've added another scan through the insns. If you look about a
half-dozen lines down from your insertion point you'll find an
existing loop to walk over all the insns.
By putting your code to initialize LABEL_REFs in there you cut out
most of the overhead.
Otherwise it looks fine.
Note that if move your initialization code for LABEL_REFS into the
existing loop, most of your overhead disappears and you might want
to remove the flag_expensive_optimization check. The only real
overhead left would be a couple prev_nonnote_insn calls when we
encounter a CODE_LABEL with a use count of 1 which would be the
exception rather than the rule I would think.
jeff