summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-01-05 12:00:00 +0000
committerlaw <law@138bc75d-0d04-0410-961f-82ee72b054a4>1998-01-05 12:00:00 +0000
commit3ad3a0ed3b930971ede746d203c141f93f29f7fd (patch)
treeeb239ac21e21be77b93d04d5995bbba8bcbded94
parent300e09fed88357a628e0c4da3c42421daa871582 (diff)
downloadgcc-3ad3a0ed3b930971ede746d203c141f93f29f7fd.tar.gz
* alias.c (*_dependence): Call base_alias_check before canon_rtx.
(base_alias_check): If no base found for address call canon_rtx and try again. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@17296 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/alias.c58
2 files changed, 46 insertions, 18 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f4c63a918c7..6dc60edadd0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+Mon Jan 5 13:00:18 1998 John F. Carr <jfc@mit.edu>
+
+ * alias.c (*_dependence): Call base_alias_check before canon_rtx.
+ (base_alias_check): If no base found for address call canon_rtx and
+ try again.
+
Mon Jan 5 11:39:49 1998 Jeffrey A Law (law@cygnus.com)
* mips.c (mips_expand_prologue): Handle large frame with no outgoing
diff --git a/gcc/alias.c b/gcc/alias.c
index 1a896454935..4292a992d9e 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -1,5 +1,5 @@
/* Alias analysis for GNU C
- Copyright (C) 1997 Free Software Foundation, Inc.
+ Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Contributed by John Carr (jfc@mit.edu).
This file is part of GNU CC.
@@ -555,10 +555,31 @@ base_alias_check (x, y)
rtx x_base = find_base_term (x);
rtx y_base = find_base_term (y);
- /* If either base address is unknown or the base addresses are equal,
- nothing is known about aliasing. */
+ /* If the address itself has no known base see if a known equivalent
+ value has one. If either address still has no known base, nothing
+ is known about aliasing. */
+ if (x_base == 0)
+ {
+ rtx x_c;
+ if (! flag_expensive_optimizations || (x_c = canon_rtx (x)) == x)
+ return 1;
+ x_base = find_base_term (x_c);
+ if (x_base == 0)
+ return 1;
+ }
- if (x_base == 0 || y_base == 0 || rtx_equal_p (x_base, y_base))
+ if (y_base == 0)
+ {
+ rtx y_c;
+ if (! flag_expensive_optimizations || (y_c = canon_rtx (y)) == y)
+ return 1;
+ y_base = find_base_term (y_c);
+ if (y_base == 0)
+ return 1;
+ }
+
+ /* If the base addresses are equal nothing is known about aliasing. */
+ if (rtx_equal_p (x_base, y_base))
return 1;
/* The base addresses of the read and write are different
@@ -721,7 +742,9 @@ memrefs_conflict_p (xsize, x, ysize, y, c)
}
/* Treat an access through an AND (e.g. a subword access on an Alpha)
- as an access with indeterminate size. */
+ as an access with indeterminate size.
+ ??? Could instead convert an n byte reference at (and x y) to an
+ n-y byte reference at (plus x y). */
if (GET_CODE (x) == AND && GET_CODE (XEXP (x, 1)) == CONST_INT)
return memrefs_conflict_p (-1, XEXP (x, 0), ysize, y, c);
if (GET_CODE (y) == AND && GET_CODE (XEXP (y, 1)) == CONST_INT)
@@ -822,14 +845,12 @@ true_dependence (mem, mem_mode, x, varies)
if (RTX_UNCHANGING_P (x) && ! RTX_UNCHANGING_P (mem))
return 0;
+ if (! base_alias_check (XEXP (x, 0), XEXP (mem, 0)))
+ return 0;
+
x_addr = canon_rtx (XEXP (x, 0));
mem_addr = canon_rtx (XEXP (mem, 0));
- /* Calling base_alias_check after canon_rtx detects more nonconflicting
- accesses at the cost of increased memory use. */
- if (! base_alias_check (x_addr, mem_addr))
- return 0;
-
if (mem_mode == VOIDmode)
mem_mode = GET_MODE (mem);
@@ -878,17 +899,18 @@ anti_dependence (mem, x)
/* If MEM is an unchanging read, then it can't possibly conflict with
the store to X, because there is at most one store to MEM, and it must
have occurred somewhere before MEM. */
- x = canon_rtx (x);
- mem = canon_rtx (mem);
if (RTX_UNCHANGING_P (mem))
return 0;
+ if (! base_alias_check (XEXP (x, 0), XEXP (mem, 0)))
+ return 0;
+
+ x = canon_rtx (x);
+ mem = canon_rtx (mem);
+
x_addr = XEXP (x, 0);
mem_addr = XEXP (mem, 0);
- if (! base_alias_check (x_addr, mem_addr))
- return 0;
-
return (memrefs_conflict_p (SIZE_FOR_MODE (mem), mem_addr,
SIZE_FOR_MODE (x), x_addr, 0)
&& ! (MEM_IN_STRUCT_P (mem) && rtx_addr_varies_p (mem)
@@ -911,12 +933,12 @@ output_dependence (mem, x)
if (MEM_VOLATILE_P (x) && MEM_VOLATILE_P (mem))
return 1;
- x = canon_rtx (x);
- mem = canon_rtx (mem);
-
if (! base_alias_check (XEXP (x, 0), XEXP (mem, 0)))
return 0;
+ x = canon_rtx (x);
+ mem = canon_rtx (mem);
+
return (memrefs_conflict_p (SIZE_FOR_MODE (mem), XEXP (mem, 0),
SIZE_FOR_MODE (x), XEXP (x, 0), 0)
&& ! (MEM_IN_STRUCT_P (mem) && rtx_addr_varies_p (mem)