This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[varmap] Fix some inlining glitches


Hi,

during inlining we create new decls per each parameters, and we want to 
associated _those_ to the SSA names in question, not the variables of 
whatever was stored into the parameter, i.e. for

   inline void bar (int i) { ... }
   foo(int j) { bar(j); }

we want to associate the name 'i' with the SSA name created for the 
inlined body.

Also we don't want to be too eager to remove block scopes that contain 
interesting variable declarations.

Will apply to the var-mappings-branch.


Ciao,
Michael.
-- 
	* tree-ssa-live.c (remove_unused_scope_block_p): Preserve
	some more scopes.
	* tree-inline.c (setup_one_parameter): Associate new decl,
	not the one from the origin.
	
Index: tree-ssa-live.c
===================================================================
--- tree-ssa-live.c	(revision 130292)
+++ tree-ssa-live.c	(working copy)
@@ -493,8 +493,11 @@ remove_unused_scope_block_p (tree scope)
 	 info about optimized-out variables in the scope blocks.
 	 Exception are the scope blocks not containing any instructions
 	 at all so user can't get into the scopes at first place.  */
-      else if ((ann = var_ann (*t)) != NULL
+      else if (((ann = var_ann (*t)) != NULL
 		&& ann->used)
+	       /* Preserve block scopes of decls we want to preserve for
+		  debugging purposes.  */
+	       || DECL_NOGC_P (*t))
 	unused = false;
 
       /* When we are not doing full debug info, we however can keep around
Index: tree-inline.c
===================================================================
--- tree-inline.c	(revision 130292)
+++ tree-inline.c	(working copy)
@@ -1525,7 +1525,7 @@ setup_one_parameter (copy_body_data *id,
 	 from inside the inlined function should be empty (as DEFs definition
 	 should be a default def).  */
       if (TREE_CODE (rhs) == SSA_NAME)
-	ssa_varmap_add_var (rhs, SSA_NAME_VAR (def));
+	ssa_varmap_add_var (rhs, var);
       insert_decl_map (id, def, rhs);
       return;
     }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]