[PATCH] Avoid emitting useless notes in GCSE

Roger Sayle roger@eyesopen.com
Sun Apr 3 17:37:00 GMT 2005


On Wed, 30 Mar 2005, Eric Botcazou wrote:
> 2005-03-30  Eric Botcazou  <ebotcazou@adacore.com>
>
> 	* gcse.c (try_replace_reg): Do not emit a REG_EQUAL note if the source
> 	of the SET has not been modified.

This is OK if properly tested.  I acknowledge Joern's concern that there
could theoretically be places where these "useless" notes may potentially
help.  However, this requires (i) GCSE to add the duplicate REG_EQUAL
note, (ii) Some later pass to eliminate/replace the constant with
something else (perhaps reload) and (iii) some even later pass to benefit
from having the REG_EQUAL note there.  Possible, but unlikely.

Instead, not only do we use more memory tracking these notes, but they
also affect compile-time when used in cselib, GCSE and particularly
"combine_insns" in combine.c.  There's an argument to increase the use
of REG_EQUAL notes in combine.c, which is already a performance hot-spot
and each duplicate note would double the time taken to process each
combinable insn.

As Joern suggested/agreed, if we ever find a case where these notes
improve(d) things, we should fix the (ii) pass, that eliminated the
constant operand without (re)placing a REG_EQUAL note.  To confirm that
your change typically doesn't affect generated code, you might want
to double check that "cc1" (or some similar large corpus) generates
identically the same code after as before.

Roger
--



More information about the Gcc-patches mailing list