From d746694a4593b1401b9638d605f59083d488af1e Mon Sep 17 00:00:00 2001 From: Richard Kenner Date: Sun, 11 Nov 2001 10:51:17 +0000 Subject: [PATCH] alias.c (nonoverlapping_memrefs_p): Not overlapping if one base is constant and one is on frame. * 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 | 6 ++++++ gcc/alias.c | 21 ++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e2782cb351a..00e473681df 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Sun Nov 11 05:56:01 2001 Richard Kenner + + * 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 * alpha/unicosmk.h (ASM_OUTPUT_DOUBLE, ASM_OUTPUT_FLOAT): Fix diff --git a/gcc/alias.c b/gcc/alias.c index add9c94bb48..2e03a068a55 100644 --- a/gcc/alias.c +++ b/gcc/alias.c @@ -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)); -- 2.30.2