From: Paolo Bonzini Date: Thu, 24 Nov 2005 09:47:36 +0000 (+0000) Subject: gcse.c (hash_scan_set): Look through REG_EQUAL or REG_EQUIV notes also when doing... X-Git-Tag: releases/gcc-4.2.0~5778 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9063128058ba5d3323a02f897f75c8818863430d;p=thirdparty%2Fgcc.git gcse.c (hash_scan_set): Look through REG_EQUAL or REG_EQUIV notes also when doing PRE... 2005-11-24 Paolo Bonzini * gcse.c (hash_scan_set): Look through REG_EQUAL or REG_EQUIV notes also when doing PRE, rather than only for global CPROP. From-SVN: r107456 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 67e050a72e63..361250db8123 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-11-24 Paolo Bonzini + + * gcse.c (hash_scan_set): Look through REG_EQUAL or REG_EQUIV notes + also when doing PRE, rather than only for global CPROP. + 2005-11-24 Ben Elliston * machmode.h (CLASS_HAS_WIDER_MODES_P): New macro. diff --git a/gcc/gcse.c b/gcc/gcse.c index 2c74574b4493..3a53d9e4d26c 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -1700,10 +1700,15 @@ hash_scan_set (rtx pat, rtx insn, struct hash_table *table) unsigned int regno = REGNO (dest); rtx tmp; - /* 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))) + /* See if a REG_NOTE shows this equivalent to a simpler expression. + This allows us to do a single GCSE pass and still eliminate + redundant constants, addresses or other expressions that are + constructed with multiple instructions. */ + 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 +1729,7 @@ hash_scan_set (rtx pat, rtx insn, struct hash_table *table) 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