tree-dfa.c (add_referenced_var): Don't walk initializer of external and non-constant...
authorJan Hubicka <jh@suse.cz>
Thu, 3 Mar 2005 19:53:47 +0000 (20:53 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Thu, 3 Mar 2005 19:53:47 +0000 (19:53 +0000)
* tree-dfa.c (add_referenced_var): Don't walk initializer of external
and non-constant public variables.

From-SVN: r95844

gcc/ChangeLog
gcc/tree-dfa.c

index ba2e68a1fe6600143ab5f3e597a7c3b38149256c..1b544690f48fc0734f441d1d651ae4e8980b9e63 100644 (file)
@@ -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
index b591ffb5e7edad92011b8d6fed6a7875d5c85313..641bb1b4df44f2c27804cf413389d1ede4f0baa5 100644 (file)
@@ -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);
     }
 }