This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Don't replace givs that are used before being set
- To: gcc-patches at gcc dot gnu dot org
- Subject: Re: Don't replace givs that are used before being set
- From: Alexandre Oliva <aoliva at cygnus dot com>
- Date: 29 May 2000 14:38:45 -0300
- Organization: Cygnus Solutions, a Red Hat Company
- References: <orwvkmsv3z.fsf@tamanduatei.dcc.unicamp.br>
On May 22, 2000, Alexandre Oliva <aoliva@cygnus.com> wrote:
> gcc.c-torture/execute/20000225-1.c fails because GCC decides to
> replace a giv whose initial value is used before it is set within a
> loop. Here's a patch that fixes this testcase without any regressions
> (except for the obvious potential performance regressions). Ok to
> install?
Here's an updated patch. The original patch missed the assignment to
v->replaceable, as Joern Rennecke kindly pointed out in private. Ok
to install?
Index: gcc/ChangeLog
from Alexandre Oliva <aoliva@cygnus.com>
* loop.c (record_giv): If giv is used before being set, don't
replace it.
Index: gcc/loop.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/loop.c,v
retrieving revision 1.250
diff -u -r1.250 loop.c
--- gcc/loop.c 2000/05/19 22:27:26 1.250
+++ gcc/loop.c 2000/05/22 10:31:37
@@ -5586,6 +5586,16 @@
break;
}
}
+ /* If we use a giv before it is set in the loop, we could only
+ replace it if we could ensure that it was initialized with
+ the right value. For now, let's just assume we can't replace
+ it. */
+ else if (uid_luid[REGNO_FIRST_UID (REGNO (dest_reg))]
+ < uid_luid[INSN_UID (insn)])
+ {
+ v->replaceable = 0;
+ v->not_replaceable = 1;
+ }
else
{
/* May still be replaceable, we don't have enough info here to
--
Alexandre Oliva Enjoy Guaranį, see http://www.ic.unicamp.br/~oliva/
Cygnus Solutions, a Red Hat company aoliva@{redhat, cygnus}.com
Free Software Developer and Evangelist CS PhD student at IC-Unicamp
oliva@{lsd.ic.unicamp.br, gnu.org} Write to mailing lists, not to me