This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] GCSE the content of REG_EQUAL/REG_EQUIV notes as well
- From: Paolo Bonzini <paolo dot bonzini at lu dot unisi dot ch>
- To: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 23 Nov 2005 18:46:57 +0100
- Subject: [PATCH] GCSE the content of REG_EQUAL/REG_EQUIV notes as well
This patch instructs GCSE to record the values in a REG_EQUAL or
REG_EQUIV note, so that it is able to eliminate the redundancy.
In practice, this makes it able to move complex addresses (such as those
produced by position-independent code) with a single PRE pass. It makes
a difference when GCC is given -fno-cse-skip-blocks -fno-cse-follow-jumps.
Bootstrapped on i686-pc-linux-gnu, all languages. Ok for mainline?
Paolo
2005-11-23 Paolo Bonzini <bonzini@gnu.org>
* gcse.c (hash_scan_set): Look through REG_EQUAL or REG_EQUIV notes
also when doing PRE, rather than only for global CPROP.
Index: gcse.c
===================================================================
--- gcse.c (revision 107311)
+++ gcse.c (working copy)
@@ -1702,8 +1702,11 @@ hash_scan_set (rtx pat, rtx insn, struct
/* If this is a single set and we are doing constant propagation,
see if a REG_NOTE shows this equivalent to a constant. */
- if (table->set_p && (note = find_reg_equal_equiv_note (insn)) != 0
- && gcse_constant_p (XEXP (note, 0)))
+ note = find_reg_equal_equiv_note (insn);
+ if (note != 0
+ && (table->set_p
+ ? gcse_constant_p (XEXP (note, 0))
+ : want_to_gcse_p (XEXP (note, 0))))
src = XEXP (note, 0), pat = gen_rtx_SET (VOIDmode, dest, src);
/* Only record sets of pseudo-regs in the hash table. */
@@ -1724,8 +1727,7 @@ hash_scan_set (rtx pat, rtx insn, struct
REG_EQUIV notes and if the argument slot is used somewhere
explicitly, it means address of parameter has been taken,
so we should not extend the lifetime of the pseudo. */
- && ((note = find_reg_note (insn, REG_EQUIV, NULL_RTX)) == 0
- || ! MEM_P (XEXP (note, 0))))
+ && (note == NULL_RTX || ! MEM_P (XEXP (note, 0))))
{
/* An expression is not anticipatable if its operands are
modified before this insn or if this is not the only SET in