Patchwork Followup referenced vars TLC

login
register
mail settings
Submitter Richard Guenther
Date July 20, 2012, 9:57 a.m.
Message ID <alpine.LNX.2.00.1207201153440.17088@jbgna.fhfr.qr>
Download mbox | patch
Permalink /patch/172192/
State New
Headers show

Comments

Richard Guenther - July 20, 2012, 9:57 a.m.
This removes one odd piece in add_local_variables:

   FOR_EACH_LOCAL_DECL (callee, ix, var)
-    if (TREE_STATIC (var) && !TREE_ASM_WRITTEN (var))
-      {
-       if (!check_var_ann
-           || (var_ann (var) && add_referenced_var (var)))
-         add_local_decl (caller, var);
-      }
-    else if (!can_be_nonlocal (var, id))

now that we only have a var-ann if a var is in referenced vars
but no TREE_STATIC vars are in referenced vars the check_var_ann == true
path is never reached.  The caller with check_var_ann == false is
tree_function_versioning and I don't understand why it should
specifically care about !TREE_ASM_WRITTEN.  We don't have a testcase
that breaks, so the following patch simply removes the code.

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2012-07-20  Richard Guenther  <rguenther@suse.de>

	* tree-inline.c (add_local_variables): Remove check_var_ann
	parameter and dead code.
	(expand_call_inline): Adjust.
	(tree_function_versioning): Likewise.

Patch

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c	(revision 189656)
+++ gcc/tree-inline.c	(working copy)
@@ -3781,19 +3755,13 @@  prepend_lexical_block (tree current_bloc
 
 static inline void
 add_local_variables (struct function *callee, struct function *caller,
-		     copy_body_data *id, bool check_var_ann)
+		     copy_body_data *id)
 {
   tree var;
   unsigned ix;
 
   FOR_EACH_LOCAL_DECL (callee, ix, var)
-    if (TREE_STATIC (var) && !TREE_ASM_WRITTEN (var))
-      {
-	if (!check_var_ann
-	    || (var_ann (var) && add_referenced_var (var)))
-	  add_local_decl (caller, var);
-      }
-    else if (!can_be_nonlocal (var, id))
+    if (!can_be_nonlocal (var, id))
       {
         tree new_var = remap_decl (var, id);
 
@@ -4027,7 +3995,7 @@  expand_call_inline (basic_block bb, gimp
   use_retvar = declare_return_variable (id, return_slot, modify_dest, bb);
 
   /* Add local vars in this inlined callee to caller.  */
-  add_local_variables (id->src_cfun, cfun, id, true);
+  add_local_variables (id->src_cfun, cfun, id);
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
@@ -5255,7 +5215,7 @@  tree_function_versioning (tree old_decl,
 
   if (!VEC_empty (tree, DECL_STRUCT_FUNCTION (old_decl)->local_decls))
     /* Add local vars.  */
-    add_local_variables (DECL_STRUCT_FUNCTION (old_decl), cfun, &id, false);
+    add_local_variables (DECL_STRUCT_FUNCTION (old_decl), cfun, &id);
 
   if (DECL_RESULT (old_decl) == NULL_TREE)
     ;