tree-dfa.c (remove_referenced_var): If removing a variable which has subvars...
authorRichard Guenther <rguenther@suse.de>
Thu, 8 Nov 2007 22:35:44 +0000 (22:35 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 8 Nov 2007 22:35:44 +0000 (22:35 +0000)
2007-11-08  Richard Guenther  <rguenther@suse.de>

* tree-dfa.c (remove_referenced_var): If removing a
variable which has subvars, also remove those from
the referenced vars.  Do not create a variable annotation.

From-SVN: r130030

gcc/ChangeLog
gcc/tree-dfa.c

index f28f013..2d0e93c 100644 (file)
@@ -1,3 +1,9 @@
+2007-11-08  Richard Guenther  <rguenther@suse.de>
+
+       * tree-dfa.c (remove_referenced_var): If removing a
+       variable which has subvars, also remove those from
+       the referenced vars.  Do not create a variable annotation.
+
 2007-11-08  Bob Wilson  <bob.wilson@acm.org>
 
        * config/xtensa/xtensa.c (xtensa_expand_prologue): Remove first
index 6ee90d7..4880e83 100644 (file)
@@ -751,10 +751,22 @@ remove_referenced_var (tree var)
   struct tree_decl_minimal in;
   void **loc;
   unsigned int uid = DECL_UID (var);
+  subvar_t sv;
+
+  /* If we remove a var, we should also remove its subvars, as we kill
+     their parent var and its annotation.  */
+  if (var_can_have_subvars (var)
+      && (sv = get_subvars_for_var (var)))
+    {
+      unsigned int i;
+      tree subvar;
+      for (i = 0; VEC_iterate (tree, sv, i, subvar); ++i)
+        remove_referenced_var (subvar);
+    }
 
   clear_call_clobbered (var);
-  v_ann = get_var_ann (var);
-  ggc_free (v_ann);
+  if ((v_ann = var_ann (var)))
+    ggc_free (v_ann);
   var->base.ann = NULL;
   gcc_assert (DECL_P (var));
   in.uid = uid;