This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Register elimination fix


The following patch fixes a problem with a shortcut in register elimination.
We'd overlook that if we have an addition of eliminable register and constant
as a SET_SRC, the SET_DEST might be a memory location that references
eliminable registers.  We didn't look inside these.

This patch changes the code to only allow such additions if the destination
is also a register.  Bootstrapped on i686-linux with the 3.0 branch.  Applied
to branch and mainline.


Bernd

	* reload1.c (eliminate_regs_in_insn): Restrict the special case
        code not to try to optimize adds with anything but a REG destination.

Index: reload1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload1.c,v
retrieving revision 1.255.4.2
diff -u -p -r1.255.4.2 reload1.c
--- reload1.c	2001/02/18 18:24:48	1.255.4.2
+++ reload1.c	2001/03/01 13:10:01
@@ -3016,6 +3016,7 @@ eliminate_regs_in_insn (insn, replace)
      currently support: a single set with the source being a PLUS of an
      eliminable register and a constant.  */
   if (old_set
+      && GET_CODE (SET_DEST (old_set)) == REG
       && GET_CODE (SET_SRC (old_set)) == PLUS
       && GET_CODE (XEXP (SET_SRC (old_set), 0)) == REG
       && GET_CODE (XEXP (SET_SRC (old_set), 1)) == CONST_INT


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]