alias.c (nonoverlapping_memrefs_p): Not overlapping if one base is constant and one...
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>
Sun, 11 Nov 2001 10:51:17 +0000 (10:51 +0000)
committerRichard Kenner <kenner@gcc.gnu.org>
Sun, 11 Nov 2001 10:51:17 +0000 (05:51 -0500)
* alias.c (nonoverlapping_memrefs_p): Not overlapping if one base is
constant and one is on frame.
If know memref offset, adjust size from decl.

From-SVN: r46925

gcc/ChangeLog
gcc/alias.c

index e2782cb351a7692531917c7d29d028e0b4597b0f..00e473681df57b9d84e5ac79e11e659041953a15 100644 (file)
@@ -1,3 +1,9 @@
+Sun Nov 11 05:56:01 2001  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * alias.c (nonoverlapping_memrefs_p): Not overlapping if one base is
+       constant and one is on frame.
+       If know memref offset, adjust size from decl.
+
 2001-11-11  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * alpha/unicosmk.h (ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT): Fix
index add9c94bb4815019441950a78d76f25b39aeab9d..2e03a068a55de314e3d84bd63b43c7fdfc584937 100644 (file)
@@ -1798,13 +1798,16 @@ nonoverlapping_memrefs_p (x, y)
   if (GET_CODE (basey) == PLUS && GET_CODE (XEXP (basey, 1)) == CONST_INT)
     offsety = INTVAL (XEXP (basey, 1)), basey = XEXP (basey, 0);
 
-  /* If the bases are both constant and they are different, we know these
-     do not overlap.  If they are both registers, we can only deduce
-     something if they are the same register.  */
-  if (CONSTANT_P (basex) && CONSTANT_P (basey) && ! rtx_equal_p (basex, basey))
-    return 1;
-  else if (! rtx_equal_p (basex, basey))
-    return 0;
+  /* If the bases are different, we know they do not overlap if both
+     are constants or if one is a constant and the other a pointer into the 
+     stack frame.  Otherwise a different base means we can't tell if they
+     overlap or not.  */
+  if (! rtx_equal_p (basex, basey))
+      return ((CONSTANT_P (basex) && CONSTANT_P (basey))
+             || (CONSTANT_P (basex) && REG_P (basey)
+                 && REGNO (basey) <= LAST_VIRTUAL_REGISTER)
+             || (CONSTANT_P (basey) && REG_P (basex)
+                 && REGNO (basex) <= LAST_VIRTUAL_REGISTER));
 
   sizex = (REG_P (rtlx) ? GET_MODE_SIZE (GET_MODE (rtlx))
           : MEM_SIZE (rtlx) ? INTVAL (MEM_SIZE (rtlx))
@@ -1816,9 +1819,9 @@ nonoverlapping_memrefs_p (x, y)
   /* If we have an offset or size for either memref, it can update the values
      computed above.  */
   if (MEM_OFFSET (x))
-    offsetx += INTVAL (MEM_OFFSET (x));
+    offsetx += INTVAL (MEM_OFFSET (x)), sizex -= INTVAL (MEM_OFFSET (x));
   if (MEM_OFFSET (y))
-    offsety += INTVAL (MEM_OFFSET (y));
+    offsety += INTVAL (MEM_OFFSET (y)), sizey -= INTVAL (MEM_OFFSET (y));
 
   if (MEM_SIZE (x))
     sizex = INTVAL (MEM_SIZE (x));