aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew MacLeod <amacleod@redhat.com>2005-04-08 13:09:26 +0000
committerAndrew Macleod <amacleod@gcc.gnu.org>2005-04-08 13:09:26 +0000
commit3623aa7017f2a9e867c4703e755933c10ebd4f94 (patch)
treec0b293e3155dd2e5c5cd33a337e3764d90136d92
parent627aa08ae96fd7dfad7e6f0ff6af638f70d58ceb (diff)
downloadgcc-3623aa7017f2a9e867c4703e755933c10ebd4f94.zip
gcc-3623aa7017f2a9e867c4703e755933c10ebd4f94.tar.gz
gcc-3623aa7017f2a9e867c4703e755933c10ebd4f94.tar.bz2
tree-ssa-operands.c (correct_use_link): Remove linear scan.
2005-04-08 Andrew MacLeod <amacleod@redhat.com> * tree-ssa-operands.c (correct_use_link): Remove linear scan. From-SVN: r97827
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/tree-ssa-operands.c29
2 files changed, 28 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 63c699b..33d84cf 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,7 @@
+2005-04-08 Andrew MacLeod <amacleod@redhat.com>
+
+ * tree-ssa-operands.c (correct_use_link): Remove linear scan.
+
2005-04-08 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* system.h: Revert last change.
diff --git a/gcc/tree-ssa-operands.c b/gcc/tree-ssa-operands.c
index a967f98..5d5f6ba 100644
--- a/gcc/tree-ssa-operands.c
+++ b/gcc/tree-ssa-operands.c
@@ -456,7 +456,8 @@ finalize_ssa_defs (def_optype *old_ops_p, tree stmt)
changed what this pointer points to via TREE_OPERANDS (exp, 0) = <...>.
THe contents are different, but the the pointer is still the same. This
routine will check to make sure PTR is in the correct list, and if it isn't
- put it in the correct list. */
+ put it in the correct list. We cannot simply check the previous node
+ because all nodes in the same stmt might have be changed. */
static inline void
correct_use_link (ssa_imm_use_t *ptr, tree stmt)
@@ -471,10 +472,28 @@ correct_use_link (ssa_imm_use_t *ptr, tree stmt)
prev = ptr->prev;
if (prev)
{
- /* find the root, which has a non-NULL stmt, and a NULL use. */
- while (prev->stmt == NULL || prev->use != NULL)
- prev = prev->prev;
- root = prev->stmt;
+ bool stmt_mod = true;
+ /* Find the first element which isn't a SAFE iterator, is in a sifferent
+ stmt, and is not a a modified stmt, That node is in the correct list,
+ see if we are too. */
+
+ while (stmt_mod)
+ {
+ while (prev->stmt == stmt || prev->stmt == NULL)
+ prev = prev->prev;
+ if (prev->use == NULL)
+ stmt_mod = false;
+ else
+ if ((stmt_mod = stmt_modified_p (prev->stmt)))
+ prev = prev->prev;
+ }
+
+ /* Get the ssa_name of the list the node is in. */
+ if (prev->use == NULL)
+ root = prev->stmt;
+ else
+ root = *(prev->use);
+ /* If its the right list, simply return. */
if (root == *(ptr->use))
return;
}