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]
Other format: [Raw text]

[PATCH] Don't assume MEM_SIZE is always set in rs6000 adjacent_mem_locations (PR target/34225)


Hi!

While rs6000_emit_stack_tie could be perhaps changed to add some MEM_SIZE
to the stack tie MEM (but which one, (u HWI) -1, stack frame size, something
else?), there seems to be dozens of other places which don't create MEMs
with MEM_SIZE set and the middle-end doesn't seem to rely anywhere on these to be
present either.  So I think adjacent_mem_locations shouldn't rely on them
either.

Ok for trunk?

2007-11-26  Jakub Jelinek  <jakub@redhat.com>

	PR target/34225
	* config/rs6000/rs6000.c (adjacent_mem_locations): Don't assume
	MEM_SIZE is set on all MEMs.

--- gcc/config/rs6000/rs6000.c.jj	2007-11-20 11:31:10.000000000 +0100
+++ gcc/config/rs6000/rs6000.c	2007-11-26 11:13:09.000000000 +0100
@@ -18166,9 +18166,8 @@ adjacent_mem_locations (rtx insn1, rtx i
 	  || (GET_CODE (XEXP (b, 0)) == PLUS
 	      && GET_CODE (XEXP (XEXP (b, 0), 1)) == CONST_INT)))
     {
-      HOST_WIDE_INT val0 = 0, val1 = 0;
+      HOST_WIDE_INT val0 = 0, val1 = 0, val_diff;
       rtx reg0, reg1;
-      int val_diff;
 
       if (GET_CODE (XEXP (a, 0)) == PLUS)
         {
@@ -18189,8 +18188,8 @@ adjacent_mem_locations (rtx insn1, rtx i
       val_diff = val1 - val0;
 
       return ((REGNO (reg0) == REGNO (reg1))
-	      && (val_diff == INTVAL (MEM_SIZE (a))
-                  || val_diff == -INTVAL (MEM_SIZE (b))));
+	      && ((MEM_SIZE (a) && val_diff == INTVAL (MEM_SIZE (a)))
+		  || (MEM_SIZE (b) && val_diff == -INTVAL (MEM_SIZE (b)))));
     }
 
   return false;
 
	Jakub


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