aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2005-03-03 20:53:47 +0100
committerJan Hubicka <hubicka@gcc.gnu.org>2005-03-03 19:53:47 +0000
commit59c982fe93b0c73af8e3208ae2f050cfce282849 (patch)
treedda0b5cd5fd490aa7e859092678f02933789bca8
parente59ef5430f91f355a5fe9cff78cd3b2b70399bfc (diff)
downloadgcc-59c982fe93b0c73af8e3208ae2f050cfce282849.zip
gcc-59c982fe93b0c73af8e3208ae2f050cfce282849.tar.gz
gcc-59c982fe93b0c73af8e3208ae2f050cfce282849.tar.bz2
tree-dfa.c (add_referenced_var): Don't walk initializer of external and non-constant public variables.
* tree-dfa.c (add_referenced_var): Don't walk initializer of external and non-constant public variables. From-SVN: r95844
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-dfa.c9
2 files changed, 13 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index ba2e68a..1b54469 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2005-03-03 Jan Hubicka <jh@suse.cz>
+
+ * tree-dfa.c (add_referenced_var): Don't walk initializer of external
+ and non-constant public variables.
+
2005-03-03 Kazu Hirata <kazu@cs.umass.edu>
* tree-cfg.c (stmt_starts_bb_p): Clean up by replacing code
diff --git a/gcc/tree-dfa.c b/gcc/tree-dfa.c
index b591ffb..641bb1b 100644
--- a/gcc/tree-dfa.c
+++ b/gcc/tree-dfa.c
@@ -901,7 +901,14 @@ add_referenced_var (tree var, struct walk_state *walk_state)
/* Scan DECL_INITIAL for pointer variables as they may contain
address arithmetic referencing the address of other
variables. */
- if (DECL_INITIAL (var))
+ if (DECL_INITIAL (var)
+ /* Initializers of external variables are not useful to the
+ optimizers. */
+ && !DECL_EXTERNAL (var)
+ /* It's not necessary to walk the initial value of non-constant
+ public variables because it cannot be propagated by the
+ optimizers. */
+ && (!TREE_PUBLIC (var) || !TREE_CONSTANT (var)))
walk_tree (&DECL_INITIAL (var), find_vars_r, walk_state, 0);
}
}