On 01/15/2013 08:29 PM, Alexandre Oliva wrote:
    if (rtx_equal_for_memref_p (x, y))
      {
-      if (xsize <= 0 || ysize <= 0)
+      if (xsize == 0 || ysize == 0)
        return 1;
-      if (c >= 0 && xsize > c)
+      if (c >= 0 && abs (xsize) - c > 0)
        return 1;
-      if (c < 0 && ysize+c > 0)
+      if (c < 0 && abs (ysize) + c > 0)
        return 1;
        return 0;
      }
@@ -2063,7 +2063,8 @@ memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, 
HOST_WIDE_INT c)
          y0 = canon_rtx (XEXP (y, 0));
          if (rtx_equal_for_memref_p (x0, y0))
            return (xsize == 0 || ysize == 0
-                   || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0));
+                   || (c >= 0 && abs (xsize) - c > 0)
+                   || (c < 0 && abs (ysize) + c > 0));

          /* Can't properly adjust our sizes.  */
          if (!CONST_INT_P (x1))
@@ -2119,8 +2120,9 @@ memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, 
HOST_WIDE_INT c)
        if (CONST_INT_P (x) && CONST_INT_P (y))
        {
          c += (INTVAL (y) - INTVAL (x));
-         return (xsize <= 0 || ysize <= 0
-                 || (c >= 0 && xsize > c) || (c < 0 && ysize+c > 0));
+         return (xsize == 0 || ysize == 0
+                 || (c >= 0 && abs (xsize) - c > 0)
+                 || (c < 0 && abs (ysize) + c > 0));
        }

I notice that these expressions (including the first hunk that uses ifs) are now all the same. It would seem extremely prudent to pull this out to a function so that they stay the same.

That said, I question the change of <= to == 0. If negative, we don't know how much overlap there is as far as I can see.



        if (GET_CODE (x) == CONST)
@@ -2139,7 +2141,8 @@ memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, 
HOST_WIDE_INT c)
        if (CONSTANT_P (y))
        return (xsize <= 0 || ysize <= 0
                || (rtx_equal_for_memref_p (x, y)
-                   && ((c >= 0 && xsize > c) || (c < 0 && ysize+c > 0))));
+                   && ((c >= 0 && abs (xsize) - c > 0)
+                       || (c < 0 && abs (ysize) + c > 0))));

This hunk is not needed, as we begin by eliminating <= 0. So the abs is certain to do nothing.


r~

Reply via email to