]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-dfa.c (add_referenced_var): Do not walk DECL_INITIAL for more referenced vars.
authorRichard Guenther <rguenther@suse.de>
Mon, 21 May 2012 14:53:21 +0000 (14:53 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 21 May 2012 14:53:21 +0000 (14:53 +0000)
2012-05-21  Richard Guenther  <rguenther@suse.de>

* tree-dfa.c (add_referenced_var): Do not walk DECL_INITIAL for
more referenced vars.
* tree-ssa-live.c (mark_all_vars_used_1): Only set the used
flag on variables that have a var-annotation.

From-SVN: r187719

gcc/ChangeLog
gcc/tree-dfa.c
gcc/tree-ssa-live.c

index d4f6e5fda55edb7becdde42aca679e1ab0c7a41d..7702970b9c82dde91cb2df3b3a0dc79bd94a56e9 100644 (file)
@@ -1,3 +1,10 @@
+2012-05-21  Richard Guenther  <rguenther@suse.de>
+
+       * tree-dfa.c (add_referenced_var): Do not walk DECL_INITIAL for
+       more referenced vars.
+       * tree-ssa-live.c (mark_all_vars_used_1): Only set the used
+       flag on variables that have a var-annotation.
+
 2012-05-21  Joseph Myers  <joseph@codesourcery.com>
 
        PR c/53148
index 007b8192c66843dc79f6ac0a542f0960689f9aa1..46fcfc1ef1dfa55d8d44652d97e72e6034a756fe 100644 (file)
@@ -577,24 +577,16 @@ set_default_def (tree var, tree def)
 bool
 add_referenced_var (tree var)
 {
-  gcc_assert (DECL_P (var));
+  gcc_checking_assert (TREE_CODE (var) == VAR_DECL
+                      || TREE_CODE (var) == PARM_DECL
+                      || TREE_CODE (var) == RESULT_DECL);
+
   if (!*DECL_VAR_ANN_PTR (var))
     create_var_ann (var);
 
   /* Insert VAR into the referenced_vars hash table if it isn't present.  */
   if (referenced_var_check_and_insert (var))
-    {
-      /* Scan DECL_INITIAL for pointer variables as they may contain
-        address arithmetic referencing the address of other
-        variables.  As we are only interested in directly referenced
-        globals or referenced locals restrict this to initializers
-        than can refer to local variables.  */
-      if (DECL_INITIAL (var)
-          && DECL_CONTEXT (var) == current_function_decl)
-       walk_tree (&DECL_INITIAL (var), find_vars_r, NULL, 0);
-
-      return true;
-    }
+    return true;
 
   return false;
 }
index 31eac11ba672f0887262f5f58f47fabbb338b53f..5f3484d3a7d3b0bcb92da11712de416b33fb3883 100644 (file)
@@ -377,7 +377,8 @@ mark_all_vars_used_1 (tree *tp, int *walk_subtrees, void *data)
       if (data != NULL && bitmap_clear_bit ((bitmap) data, DECL_UID (t))
          && DECL_CONTEXT (t) == current_function_decl)
        mark_all_vars_used (&DECL_INITIAL (t), data);
-      set_is_used (t);
+      if (var_ann (t) != NULL)
+       set_is_used (t);
     }
   /* remove_unused_scope_block_p requires information about labels
      which are not DECL_IGNORED_P to tell if they might be used in the IL.  */