This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Questions about i386 redundant test and comparison removal
- To: john at feith dot com (John Wehle)
- Subject: Re: Questions about i386 redundant test and comparison removal
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Mon, 08 Jun 1998 02:25:28 -0600
- cc: egcs at cygnus dot com
- Reply-To: law at cygnus dot com
In message <199806061808.OAA05774@jwlab.FEITH.COM>you write:
> I don't understand why SET_DESTs needs to be tracked. NOTICE_UPDATE_CC
> can still invalidate the known cc0 status at the second set of regx since
> it was mentioned as the SET_SRC for the first set of cc0. I understand
> the need to invalidate, I'm just not seeing how that requires tracking
> the SET_DESTs.
A "tst" instruction looks like:
> Tracking SET_DESTs does allow for noticing that set cc0 is redundant in
> the example below:
>
> (set (regx) (plus ...))
>
> (set (cc0) (regx))
Right. Now imagine that there's an insn which sets "regx" between
those instructions, but does not set cc0.
The compiler may believe the (set (cc0) (regx)) is redundant, when
in fact it is not redundant.
How else do you know that you have to clobber the cc0 status? ie,
you would not want to clobber cc0 status if an insn between those
sets loaded a different register without setting cc0.
Sorry if my explanations aren't clear, it's been quite some time
since I had to work with this particular optimization.
jeff