This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Delete moves that are turned into no-ops by reload_cse
- From: Richard Sandiford <richard at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: stevenb dot gcc at gmail dot com
- Date: Mon, 27 Feb 2006 15:13:56 +0000
- Subject: Delete moves that are turned into no-ops by reload_cse
As well as doing CSE, reload_cse has code to delete no-op moves.
What's slightly odd is that this code is skipped for moves that
were simplified by CSE itself.
This patch fixes that. I checked that postreload now removes the
no-op that Steven described here:
http://gcc.gnu.org/ml/gcc/2006-02/msg00650.html
Bootstrapped & regression-tested on i686-pc-linux-gnu. OK to install?
Richard
* postreload.c (reload_cse_simplify): Delete moves that are turned
into no-ops by CSE.
Index: gcc/postreload.c
===================================================================
--- gcc/postreload.c (revision 111473)
+++ gcc/postreload.c (working copy)
@@ -99,12 +99,13 @@ reload_cse_simplify (rtx insn, rtx testr
this out, so it's safer to simplify before we delete. */
count += reload_cse_simplify_set (body, insn);
- if (!count && reload_cse_noop_set_p (body))
+ if (reload_cse_noop_set_p (body))
{
rtx value = SET_DEST (body);
if (REG_P (value)
&& ! REG_FUNCTION_VALUE_P (value))
value = 0;
+ cancel_changes (0);
delete_insn_and_edges (insn);
return;
}