diff options
author | Steven Bosscher <stevenb.gcc@gmail.com> | 2008-05-25 11:58:18 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-05-25 11:58:18 +0000 |
commit | 294707717f6b7f293601c3dda20cb6405c6a3a6f (patch) | |
tree | 2ea11ece9f86e4a8241ad5cea1e2da5c18fbd69c /gcc | |
parent | dd25a747c916bf685457171d18712bbff325babc (diff) | |
download | gcc-294707717f6b7f293601c3dda20cb6405c6a3a6f.zip gcc-294707717f6b7f293601c3dda20cb6405c6a3a6f.tar.gz gcc-294707717f6b7f293601c3dda20cb6405c6a3a6f.tar.bz2 |
gcse.c (hash_scan_set): Do not pick up a REG_EQUAL value if SRC is a REG.
2008-05-25 Steven Bosscher <stevenb.gcc@gmail.com>
* gcse.c (hash_scan_set): Do not pick up a REG_EQUAL value if
SRC is a REG.
From-SVN: r135860
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/gcse.c | 17 |
2 files changed, 20 insertions, 2 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5c4a0b3..0588af6 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2008-05-25 Steven Bosscher <stevenb.gcc@gmail.com> + + * gcse.c (hash_scan_set): Do not pick up a REG_EQUAL value if + SRC is a REG. + 2008-05-25 Alan Modra <amodra@bigpond.net.au> * c-common.c (strip_array_types): Move function to.. @@ -1692,12 +1692,25 @@ hash_scan_set (rtx pat, rtx insn, struct hash_table *table) unsigned int regno = REGNO (dest); rtx tmp; - /* See if a REG_NOTE shows this equivalent to a simpler expression. + /* See if a REG_EQUAL 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. */ + constructed with multiple instructions. + + However, keep the original SRC if INSN is a simple reg-reg move. In + In this case, there will almost always be a REG_EQUAL note on the + insn that sets SRC. By recording the REG_EQUAL value here as SRC + for INSN, we miss copy propagation opportunities and we perform the + same PRE GCSE operation repeatedly on the same REG_EQUAL value if we + do more than one PRE GCSE pass. + + Note that this does not impede profitale constant propagations. We + "look through" reg-reg sets in lookup_avail_set. */ note = find_reg_equal_equiv_note (insn); if (note != 0 + && REG_NOTE_KIND (note) == REG_EQUAL + && !REG_P (src) && (table->set_p ? gcse_constant_p (XEXP (note, 0)) : want_to_gcse_p (XEXP (note, 0)))) |