tree-dfa.c (collect_dfa_stats): Simplify.
authorRichard Guenther <rguenther@suse.de>
Fri, 20 Jul 2012 12:56:41 +0000 (12:56 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Fri, 20 Jul 2012 12:56:41 +0000 (12:56 +0000)
2012-07-20  Richard Guenther  <rguenther@suse.de>

* tree-dfa.c (collect_dfa_stats): Simplify.
* tree-ssa-structalias.c (compute_may_aliases): Do not dump
referenced vars.
* cfgexpand.c (estimated_stack_frame_size): Walk over local
decls instead of referenced vars.
* tree-ssa.c (delete_tree_ssa): Simplify.
* tree-tailcall.c (find_tail_calls): Walk over local decls
instead of referenced vars.
(add_virtual_phis): Remove.
(tree_optimize_tail_calls_1): Instead mark the virtual operand
for renaming.

From-SVN: r189718

gcc/ChangeLog
gcc/cfgexpand.c
gcc/tree-dfa.c
gcc/tree-ssa-structalias.c
gcc/tree-ssa.c
gcc/tree-tailcall.c

index 3bb9763337c287789f1e190f8bb4cb33f0a9e04e..79a9ec77d3d4ea4ccc903f835f3bbbe6c7f66576 100644 (file)
@@ -1,3 +1,17 @@
+2012-07-20  Richard Guenther  <rguenther@suse.de>
+
+       * tree-dfa.c (collect_dfa_stats): Simplify.
+       * tree-ssa-structalias.c (compute_may_aliases): Do not dump
+       referenced vars.
+       * cfgexpand.c (estimated_stack_frame_size): Walk over local
+       decls instead of referenced vars.
+       * tree-ssa.c (delete_tree_ssa): Simplify.
+       * tree-tailcall.c (find_tail_calls): Walk over local decls
+       instead of referenced vars.
+       (add_virtual_phis): Remove.
+       (tree_optimize_tail_calls_1): Instead mark the virtual operand
+       for renaming.
+
 2012-07-20  Steven Bosscher  <steven@gcc.gnu.org>
 
        * basic-block.h (BB_FLAGS_TO_PRESERVE): New define.
index b767fe63ef8b0e1a0e9a63d25ebf4fb9b7972b1c..96c2e2ed8a2079ee148e7279c147db6ff7a1e01a 100644 (file)
@@ -1420,15 +1420,14 @@ estimated_stack_frame_size (struct cgraph_node *node)
   size_t i;
   tree var;
   tree old_cur_fun_decl = current_function_decl;
-  referenced_var_iterator rvi;
   struct function *fn = DECL_STRUCT_FUNCTION (node->symbol.decl);
 
   current_function_decl = node->symbol.decl;
   push_cfun (fn);
 
-  gcc_checking_assert (gimple_referenced_vars (fn));
-  FOR_EACH_REFERENCED_VAR (fn, var, rvi)
-    size += expand_one_var (var, true, false);
+  FOR_EACH_LOCAL_DECL (fn, i, var)
+    if (auto_var_in_fn_p (var, fn->decl))
+      size += expand_one_var (var, true, false);
 
   if (stack_vars_num > 0)
     {
index 7d20f6f1496acfaec84886a9bfbb166c9535b2d4..f8ebfd2697299a5f993a4dc298b428ec8fcb272a 100644 (file)
@@ -371,17 +371,13 @@ static void
 collect_dfa_stats (struct dfa_stats_d *dfa_stats_p ATTRIBUTE_UNUSED)
 {
   basic_block bb;
-  referenced_var_iterator vi;
-  tree var;
 
   gcc_assert (dfa_stats_p);
 
   memset ((void *)dfa_stats_p, 0, sizeof (struct dfa_stats_d));
 
   /* Count all the variable annotations.  */
-  FOR_EACH_REFERENCED_VAR (cfun, var, vi)
-    if (var_ann (var))
-      dfa_stats_p->num_var_anns++;
+  dfa_stats_p->num_var_anns = htab_elements (gimple_referenced_vars (cfun));
 
   /* Walk all the statements in the function counting references.  */
   FOR_EACH_BB (bb)
index caf350632b122d537cdd6be70edbd4b65b996ae4..5c229e942676b329f2beb95c8a70231ae7af129e 100644 (file)
@@ -6736,9 +6736,6 @@ compute_may_aliases (void)
 
          /* But still dump what we have remaining it.  */
          dump_alias_info (dump_file);
-
-         if (dump_flags & TDF_DETAILS)
-           dump_referenced_vars (dump_file);
        }
 
       return 0;
@@ -6751,12 +6748,7 @@ compute_may_aliases (void)
 
   /* Debugging dumps.  */
   if (dump_file)
-    {
-      dump_alias_info (dump_file);
-
-      if (dump_flags & TDF_DETAILS)
-       dump_referenced_vars (dump_file);
-    }
+    dump_alias_info (dump_file);
 
   /* Deallocate memory used by aliasing data structures and the internal
      points-to solution.  */
index 36aaffdecc4cf0b3eddde957615415dbe21c558b..9acb03549410728937e04aa2f1f0ae2ea0ebc91c 100644 (file)
@@ -1156,13 +1156,8 @@ delete_tree_ssa (void)
   /* Remove annotations from every referenced local variable.  */
   FOR_EACH_REFERENCED_VAR (cfun, var, rvi)
     {
-      if (is_global_var (var))
-       continue;
-      if (var_ann (var))
-       {
-         ggc_free (var_ann (var));
-         *DECL_VAR_ANN_PTR (var) = NULL;
-       }
+      ggc_free (var_ann (var));
+      *DECL_VAR_ANN_PTR (var) = NULL;
     }
   htab_delete (gimple_referenced_vars (cfun));
   cfun->gimple_df->referenced_vars = NULL;
index e2e51a45107287a94edac1b044483f7f1e8365d5..ec77c5fbeee2dadf93b5e6361eba80b7370c565a 100644 (file)
@@ -390,7 +390,6 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
   basic_block abb;
   size_t idx;
   tree var;
-  referenced_var_iterator rvi;
 
   if (!single_succ_p (bb))
     return;
@@ -484,7 +483,7 @@ find_tail_calls (basic_block bb, struct tailcall **ret)
 
   /* Make sure the tail invocation of this function does not refer
      to local variables.  */
-  FOR_EACH_REFERENCED_VAR (cfun, var, rvi)
+  FOR_EACH_LOCAL_DECL (cfun, idx, var)
     {
       if (TREE_CODE (var) != PARM_DECL
          && auto_var_in_fn_p (var, cfun->decl)
@@ -872,36 +871,6 @@ eliminate_tail_call (struct tailcall *t)
   release_defs (call);
 }
 
-/* Add phi nodes for the virtual operands defined in the function to the
-   header of the loop created by tail recursion elimination.
-
-   Originally, we used to add phi nodes only for call clobbered variables,
-   as the value of the non-call clobbered ones obviously cannot be used
-   or changed within the recursive call.  However, the local variables
-   from multiple calls now share the same location, so the virtual ssa form
-   requires us to say that the location dies on further iterations of the loop,
-   which requires adding phi nodes.
-*/
-static void
-add_virtual_phis (void)
-{
-  referenced_var_iterator rvi;
-  tree var;
-
-  /* The problematic part is that there is no way how to know what
-     to put into phi nodes (there in fact does not have to be such
-     ssa name available).  A solution would be to have an artificial
-     use/kill for all virtual operands in EXIT node.  Unless we have
-     this, we cannot do much better than to rebuild the ssa form for
-     possibly affected virtual ssa names from scratch.  */
-
-  FOR_EACH_REFERENCED_VAR (cfun, var, rvi)
-    {
-      if (!is_gimple_reg (var) && gimple_default_def (cfun, var) != NULL_TREE)
-       mark_sym_for_renaming (var);
-    }
-}
-
 /* Optimizes the tailcall described by T.  If OPT_TAILCALLS is true, also
    mark the tailcalls for the sibcall optimization.  */
 
@@ -1056,8 +1025,12 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
   if (changed)
     free_dominance_info (CDI_DOMINATORS);
 
+  /* Add phi nodes for the virtual operands defined in the function to the
+     header of the loop created by tail recursion elimination.  Do so
+     by triggering the SSA renamer.  */
   if (phis_constructed)
-    add_virtual_phis ();
+    mark_sym_for_renaming (gimple_vop (cfun));
+
   if (changed)
     return TODO_cleanup_cfg | TODO_update_ssa_only_virtuals;
   return 0;