This is the mail archive of the
egcs-patches@egcs.cygnus.com
mailing list for the EGCS project.
Re: Update for cprop patch
- To: Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
- Subject: Re: Update for cprop patch
- From: Jeffrey A Law <law@cygnus.com>
- Date: Sun, 11 Jul 1999 15:08:07 -0600
- cc: egcs-patches@egcs.cygnus.com
- Reply-To: law@cygnus.com
In message <Pine.SOL.4.10.9906012038300.24328-100000@jennifer.informatik.rwth
-aachen.de>you write:
> This is an updated version of the cprop enhancement patch I submitted a
> few weeks ago. Changes:
> - this one applies cleanly to the current CVS sources
> - In find_avail_set, avoid infinite loops when we run into a cycle (this
> can happen e.g. if we have a no-op set in the hash table).
By a no-op set I assume you mean something like
(set (reg X) (reg X))?
If so, one could argue we shouldn't ever put that into the set table to
start with.
That may (or may not) be enough to prevent cycles.
I think you want to move the call to oprs_not_set_p from cprop_insn into the
loop in find_avail_set since you want the loop to stop if it encounters a
register in the copy chain that is set earlier in the block. I believe that
will generally lead to better code and should prevent cycles.
Another approach would be to build a cprop chain of related values. Then
you start with the chain looking for the oldest entry that has not been
clobbered between the start of the block and the current insn. But I
doubt this is really worth the effort.
> * gcse.c (hash_scan_set): Treat SYMBOL_REFs like CONST_INTs.
This is OK. As is the change to cprop_insn to handle SYMBOL_REFs like
CONST_INTs. Though you may want to generalize to check CONSTANT_P. Your
call on that one, I don't know if it will actually help code or not.
> (find_avail_set): Follow chains of register-register copies.
Blocked, pending resolution of issues noted above.
> (cprop_jump): New function, broken out of cprop_insn.
> (cprop_cc0_jump): New function.
> Break out new function cprop_jump and use it.
> Also use cprop_cc0_jump for machines with CC0.
> (cprop): Don't crash if cprop_insn turned the insn into a NOTE.
Neat idea. I hadn't thought of solving the problem in that manner. I like
it.
Note that you need to verify that you're propagating a constant in this code
(ie, "src" is a CONST_INT, CONST_DOUBLE or SYMBOL_REF)
+ else if (alter_jumps
+ && GET_CODE (PATTERN (insn)) == SET
+ && SET_DEST (PATTERN (insn)) == cc0_rtx
+ && GET_CODE (NEXT_INSN (insn)) == JUMP_INSN
+ && condjump_p (NEXT_INSN (insn))
+ && ! simplejump_p (NEXT_INSN (insn)))
+ changed |= cprop_cc0_jump (insn, reg_used, src);
jeff