From 5da6f16835c04026596f53e9b7d81a99218d2381 Mon Sep 17 00:00:00 2001 From: Richard Sandiford Date: Thu, 18 Mar 2004 17:56:12 +0000 Subject: [PATCH] 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 --- gcc/ChangeLog | 5 +++++ gcc/alias.c | 21 ++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 94a75a4d74c..60791f0fcac 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2004-03-18 Richard Sandiford + + * 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 * doloop.c: Removed. diff --git a/gcc/alias.c b/gcc/alias.c index f317a5720aa..58ec82d8b86 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: -- 2.30.2