This is the mail archive of the 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]

Don't try to make SP autoincs

I had an amazing amount of fun today with a large testcase from a commercial
C testsuite which got miscompiled on sh-elf.  In the end, it turned out that
flow deleted a decrement of the stack pointer, causing all sorts of things
to go wrong later.
It didn't actually delete the decrement - it generated an autoinc addressing
mode, but it overlooked a rather large number of SP users in between the set
and the MEM.  The reg_next_use array doesn't seem to be kept accurate for the
stack pointer, and the implicit uses don't appear there anyway.  This patch
seems like the best solution to me.

	* flow.c (try_pre_increment_1): Don't do anything to sets of the
	stack pointer.

Index: flow.c
RCS file: /cvs/cvsfiles/devo/gcc/flow.c,v
retrieving revision 1.242
diff -u -p -r1.242 flow.c
--- flow.c	2000/08/29 12:08:49	1.242
+++ flow.c	2000/09/12 17:16:25
@@ -5593,6 +5593,7 @@ try_pre_increment_1 (pbi, insn)
   int regno = REGNO (SET_DEST (x));
   rtx y = pbi->reg_next_use[regno];
   if (y != 0
+      && SET_DEST (x) != stack_pointer_rtx
       && BLOCK_NUM (y) == BLOCK_NUM (insn)
       /* Don't do this if the reg dies, or gets set in y; a standard addressing
 	 mode would be better.  */

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