aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPaolo Bonzini <bonzini@gnu.org>2005-11-24 09:47:36 +0000
committerPaolo Bonzini <bonzini@gcc.gnu.org>2005-11-24 09:47:36 +0000
commit9063128058ba5d3323a02f897f75c8818863430d (patch)
tree3717e20b6ad857a72b3d06979afc1fdffaf8a953 /gcc
parent9df540a8d941d18ea691c3eba9a09d12107d5c3e (diff)
downloadgcc-9063128058ba5d3323a02f897f75c8818863430d.zip
gcc-9063128058ba5d3323a02f897f75c8818863430d.tar.gz
gcc-9063128058ba5d3323a02f897f75c8818863430d.tar.bz2
gcse.c (hash_scan_set): Look through REG_EQUAL or REG_EQUIV notes also when doing PRE...
2005-11-24 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. From-SVN: r107456
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/gcse.c16
2 files changed, 15 insertions, 6 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 67e050a..361250d 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2005-11-24 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.
+
2005-11-24 Ben Elliston <bje@au.ibm.com>
* machmode.h (CLASS_HAS_WIDER_MODES_P): New macro.
diff --git a/gcc/gcse.c b/gcc/gcse.c
index 2c74574..3a53d9e 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