aboutsummaryrefslogtreecommitdiff
path: root/gcc/alias.c
diff options
context:
space:
mode:
authorAlexandre Oliva <aoliva@redhat.com>2012-06-22 01:30:16 +0000
committerAlexandre Oliva <aoliva@gcc.gnu.org>2012-06-22 01:30:16 +0000
commita9bf4fe2dd2b64a9f8c74bbf4f2d3527b97af85b (patch)
treee05c081d7dd22a96f2bb18fb320a80b010d911d2 /gcc/alias.c
parent1ca63357cb07ce7c61ad275d8f870187d8dd8950 (diff)
downloadgcc-a9bf4fe2dd2b64a9f8c74bbf4f2d3527b97af85b.zip
gcc-a9bf4fe2dd2b64a9f8c74bbf4f2d3527b97af85b.tar.gz
gcc-a9bf4fe2dd2b64a9f8c74bbf4f2d3527b97af85b.tar.bz2
re PR debug/53671 (Many guality test failures)
PR debug/53671 PR debug/49888 * alias.c (memrefs_conflict_p): Improve handling of AND for alignment. From-SVN: r188868
Diffstat (limited to 'gcc/alias.c')
-rw-r--r--gcc/alias.c35
1 files changed, 21 insertions, 14 deletions
diff --git a/gcc/alias.c b/gcc/alias.c
index c11b13f..b6aca34 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -2097,25 +2097,32 @@ memrefs_conflict_p (int xsize, rtx x, int ysize, rtx y, HOST_WIDE_INT c)
break;
}
- /* Treat an access through an AND (e.g. a subword access on an Alpha)
- as an access with indeterminate size. Assume that references
- besides AND are aligned, so if the size of the other reference is
- at least as large as the alignment, assume no other overlap. */
+ /* Deal with alignment ANDs by adjusting offset and size so as to
+ cover the maximum range, without taking any previously known
+ alignment into account. */
if (GET_CODE (x) == AND && CONST_INT_P (XEXP (x, 1)))
{
- if (GET_CODE (y) == AND || ysize < -INTVAL (XEXP (x, 1)))
- xsize = -1;
- return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)), ysize, y, c);
+ HOST_WIDE_INT sc = INTVAL (XEXP (x, 1));
+ unsigned HOST_WIDE_INT uc = sc;
+ if (xsize > 0 && sc < 0 && -uc == (uc & -uc))
+ {
+ xsize -= sc + 1;
+ c -= sc;
+ return memrefs_conflict_p (xsize, canon_rtx (XEXP (x, 0)),
+ ysize, y, c);
+ }
}
if (GET_CODE (y) == AND && CONST_INT_P (XEXP (y, 1)))
{
- /* ??? If we are indexing far enough into the array/structure, we
- may yet be able to determine that we can not overlap. But we
- also need to that we are far enough from the end not to overlap
- a following reference, so we do nothing with that for now. */
- if (GET_CODE (x) == AND || xsize < -INTVAL (XEXP (y, 1)))
- ysize = -1;
- return memrefs_conflict_p (xsize, x, ysize, canon_rtx (XEXP (y, 0)), c);
+ HOST_WIDE_INT sc = INTVAL (XEXP (y, 1));
+ unsigned HOST_WIDE_INT uc = sc;
+ if (ysize > 0 && sc < 0 && -uc == (uc & -uc))
+ {
+ ysize -= sc + 1;
+ c += sc;
+ return memrefs_conflict_p (xsize, x,
+ ysize, canon_rtx (XEXP (y, 0)), c);
+ }
}
if (CONSTANT_P (x))