This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[vta] don't let debug insn between store and load prevent reload optimization
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Mon, 17 Nov 2008 03:18:36 -0200
- Subject: [vta] don't let debug insn between store and load prevent reload optimization
The presence of a debug insn between an output reload and an input
reload for the same pseudo would disable the potential removal of the
store. This patch fixes it. I'm installing it in the VTA branch.
for gcc/ChangeLog.vta
from Alexandre Oliva <aoliva@redhat.com>
* reload1.c (emit_input_reload_insns): Don't let debug insns get
in the way of optimizing away a SET in the previous non-debug insn
to satisfy an input reload.
Index: gcc/reload1.c
===================================================================
--- gcc/reload1.c.orig 2008-10-10 09:31:06.000000000 -0300
+++ gcc/reload1.c 2008-11-12 04:13:35.000000000 -0200
@@ -1,6 +1,6 @@
/* Reload pseudo regs into hard regs for insns that require hard regs.
Copyright (C) 1987, 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
Free Software Foundation, Inc.
This file is part of GCC.
@@ -7001,7 +7001,7 @@ emit_input_reload_insns (struct insn_cha
rl->when_needed, old, rl->out, j, 0))
{
rtx temp = PREV_INSN (insn);
- while (temp && NOTE_P (temp))
+ while (temp && (NOTE_P (temp) || DEBUG_INSN_P (temp)))
temp = PREV_INSN (temp);
if (temp
&& NONJUMP_INSN_P (temp)
@@ -7044,6 +7044,13 @@ emit_input_reload_insns (struct insn_cha
alter_reg (REGNO (old), -1, false);
}
special = 1;
+
+ /* Adjust any debug insns between temp and insn. */
+ while ((temp = NEXT_INSN (temp)) != insn)
+ if (DEBUG_INSN_P (temp))
+ replace_rtx (PATTERN (temp), old, reloadreg);
+ else
+ gcc_assert (NOTE_P (temp));
}
else
{
--
Alexandre Oliva http://www.lsd.ic.unicamp.br/~oliva/
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
FSFLA Board Member ÂSÃ Libre! => http://www.fsfla.org/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}