Patchwork Tidy up execute_update_addresses_taken

login
register
mail settings
Submitter Eric Botcazou
Date Sept. 23, 2010, 10:35 a.m.
Message ID <201009231235.24909.ebotcazou@adacore.com>
Download mbox | patch
Permalink /patch/65524/
State New
Headers show

Comments

Eric Botcazou - Sept. 23, 2010, 10:35 a.m.
> Not calling it from execute_function_todo makes sense - it doesn't make
> any sense to compute things but then to do nothing.

OK, what about the attached patch?


	* tree-flow.h (execute_update_addresses_taken): Remove parameter.
	* tree-ssa.c (execute_update_addresses_taken): Likewise.  Execute the
	optimization unconditionally.
	* passes.c (execute_function_todo): Call execute_update_addresses_taken
	unconditionally if TODO_rebuild_alias is set, else only when optimizing
	if TODO_update_address_taken is set.
Richard Guenther - Sept. 23, 2010, 10:46 a.m.
On Thu, Sep 23, 2010 at 12:35 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Not calling it from execute_function_todo makes sense - it doesn't make
>> any sense to compute things but then to do nothing.
>
> OK, what about the attached patch?

Ok.

THanks,
Richard.

>
>        * tree-flow.h (execute_update_addresses_taken): Remove parameter.
>        * tree-ssa.c (execute_update_addresses_taken): Likewise.  Execute the
>        optimization unconditionally.
>        * passes.c (execute_function_todo): Call execute_update_addresses_taken
>        unconditionally if TODO_rebuild_alias is set, else only when optimizing
>        if TODO_update_address_taken is set.
>
>
> --
> Eric Botcazou
>

Patch

Index: tree-ssa.c
===================================================================
--- tree-ssa.c	(revision 164507)
+++ tree-ssa.c	(working copy)
@@ -1944,10 +1944,11 @@  maybe_optimize_var (tree var, bitmap add
   return update_vops;
 }
 
-/* Compute TREE_ADDRESSABLE and DECL_GIMPLE_REG_P for local variables.  */
+/* When possible, clear TREE_ADDRESSABLE bit or set DECL_GIMPLE_REG_P bit for
+   local variables.  */
 
 void
-execute_update_addresses_taken (bool do_optimize)
+execute_update_addresses_taken (void)
 {
   tree var;
   gimple_stmt_iterator gsi;
@@ -2047,18 +2048,13 @@  execute_update_addresses_taken (bool do_
 	}
     }
 
-  /* When possible, clear ADDRESSABLE bit or set the REGISTER bit
-     and mark variable for conversion into SSA.  */
-  if (optimize && do_optimize)
-    {
-      /* We cannot iterate over all referenced vars as that can contain
-	 unused vars from BLOCK trees which cause code generation
-	 differences for -g vs. -g0.  */
-      for (var = DECL_ARGUMENTS (cfun->decl); var; var = DECL_CHAIN (var))
-	update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs);
-      FOR_EACH_VEC_ELT (tree, cfun->local_decls, i, var)
-	update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs);
-    }
+  /* We cannot iterate over all referenced vars because that can contain
+     unused vars from BLOCK trees, which causes code generation differences
+     for -g vs. -g0.  */
+  for (var = DECL_ARGUMENTS (cfun->decl); var; var = DECL_CHAIN (var))
+    update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs);
+  FOR_EACH_VEC_ELT (tree, cfun->local_decls, i, var)
+    update_vops |= maybe_optimize_var (var, addresses_taken, not_reg_needs);
 
   /* Operand caches needs to be recomputed for operands referencing the updated
      variables.  */
Index: tree-flow.h
===================================================================
--- tree-flow.h	(revision 164507)
+++ tree-flow.h	(working copy)
@@ -559,7 +559,7 @@  extern void delete_tree_ssa (void);
 extern bool ssa_undefined_value_p (tree);
 extern void warn_uninit (tree, const char *, void *);
 extern unsigned int warn_uninitialized_vars (bool);
-extern void execute_update_addresses_taken (bool);
+extern void execute_update_addresses_taken (void);
 
 /* Call-back function for walk_use_def_chains().  At each reaching
    definition, a function with this prototype is called.  */
Index: passes.c
===================================================================
--- passes.c	(revision 164507)
+++ passes.c	(working copy)
@@ -1208,15 +1208,13 @@  execute_function_todo (void *data)
       cfun->last_verified &= ~TODO_verify_ssa;
     }
 
-  if (flags & TODO_update_address_taken)
-    execute_update_addresses_taken (true);
-
   if (flags & TODO_rebuild_alias)
     {
-      if (!(flags & TODO_update_address_taken))
-	execute_update_addresses_taken (true);
+      execute_update_addresses_taken ();
       compute_may_aliases ();
     }
+  else if (optimize && (flags & TODO_update_address_taken))
+    execute_update_addresses_taken ();
 
   if (flags & TODO_remove_unused_locals)
     remove_unused_locals ();