aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Sandiford <rsandifo@redhat.com>2004-03-18 17:56:12 +0000
committerRichard Sandiford <rsandifo@gcc.gnu.org>2004-03-18 17:56:12 +0000
commit5da6f16835c04026596f53e9b7d81a99218d2381 (patch)
tree05697b0ec31bd950a670489cf27f0b3075ee6055 /gcc
parentacc63e4c3d942fc6669ee990f0c43b15c41c0592 (diff)
downloadgcc-5da6f16835c04026596f53e9b7d81a99218d2381.zip
gcc-5da6f16835c04026596f53e9b7d81a99218d2381.tar.gz
gcc-5da6f16835c04026596f53e9b7d81a99218d2381.tar.bz2
alias.c (record_set): Detect the case where a register is assigned a new value that has the same base...
* alias.c (record_set): Detect the case where a register is assigned a new value that has the same base term as the old one. From-SVN: r79629
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/alias.c21
2 files changed, 21 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 94a75a4..60791f0 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2004-03-18 Richard Sandiford <rsandifo@redhat.com>
+
+ * alias.c (record_set): Detect the case where a register is assigned
+ a new value that has the same base term as the old one.
+
2004-03-18 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* doloop.c: Removed.
diff --git a/gcc/alias.c b/gcc/alias.c
index f317a57..58ec82d 100644
--- a/gcc/alias.c
+++ b/gcc/alias.c
@@ -993,13 +993,24 @@ record_set (rtx dest, rtx set, void *data ATTRIBUTE_UNUSED)
return;
}
- /* This is not the first set. If the new value is not related to the
- old value, forget the base value. Note that the following code is
- not detected:
- extern int x, y; int *p = &x; p += (&y-&x);
+ /* If this is not the first set of REGNO, see whether the new value
+ is related to the old one. There are two cases of interest:
+
+ (1) The register might be assigned an entirely new value
+ that has the same base term as the original set.
+
+ (2) The set might be a simple self-modification that
+ cannot change REGNO's base value.
+
+ If neither case holds, reject the original base value as invalid.
+ Note that the following situation is not detected:
+
+ extern int x, y; int *p = &x; p += (&y-&x);
+
ANSI C does not allow computing the difference of addresses
of distinct top level objects. */
- if (new_reg_base_value[regno])
+ if (new_reg_base_value[regno] != 0
+ && find_base_value (src) != new_reg_base_value[regno])
switch (GET_CODE (src))
{
case LO_SUM: