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]

Re: [vta,vta4.4,trunk,4.4] fix -O0 -g vs -g0 codegen regression


On May 19, 2009, Richard Guenther <richard.guenther@gmail.com> wrote:

> On Tue, May 19, 2009 at 2:38 AM, Alexandre Oliva <aoliva@redhat.com> wrote:
>> This patch fixes it by avoiding, when not optimizing, the removal of
>> unused declarations from lexical blocks, as well as the lexical blocks
>> containing them. ÂSince we're not optimizing, we don't remove the decls
>> from the local decls list anyway, so I doubt this removal would have
>> saved a significant amount of memory.

> Ok.

This was not enough to address all of the regressions, unfortunately.

The first patch below is needed to fix most (perhaps all, I haven't
completed checking) of the remaining -O0 -fcompare-debug regressions.

The second patch below reverts the patch I proposed before, and
short-circuits lexical block simplification when not optimizing.  It
should make things faster when not optimizing, avoiding a lot of busy
work to decide we can't remove much anyway.

I'm installing them in vta and vta4.4.  Ok for trunk and 4.4?


for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* tree-inline.c (remap_decls): Enable nonlocalized variables
	when not optimizing.

Index: gcc/tree-inline.c
===================================================================
--- gcc/tree-inline.c.orig	2009-05-19 03:27:40.000000000 -0300
+++ gcc/tree-inline.c	2009-05-19 03:29:48.000000000 -0300
@@ -537,7 +537,7 @@ remap_decls (tree decls, VEC(tree,gc) **
 	      && (var_ann (old_var) || !gimple_in_ssa_p (cfun)))
 	    cfun->local_decls = tree_cons (NULL_TREE, old_var,
 						   cfun->local_decls);
-	  if (debug_info_level > DINFO_LEVEL_TERSE
+	  if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE)
 	      && !DECL_IGNORED_P (old_var)
 	      && nonlocalized_list)
 	    VEC_safe_push (tree, gc, *nonlocalized_list, origin_var);
@@ -555,7 +555,7 @@ remap_decls (tree decls, VEC(tree,gc) **
 	;
       else if (!new_var)
         {
-	  if (debug_info_level > DINFO_LEVEL_TERSE
+	  if ((!optimize || debug_info_level > DINFO_LEVEL_TERSE)
 	      && !DECL_IGNORED_P (old_var)
 	      && nonlocalized_list)
 	    VEC_safe_push (tree, gc, *nonlocalized_list, origin_var);
for  gcc/ChangeLog.vta
from  Alexandre Oliva  <aoliva@redhat.com>

	* tree-ssa-live.c (remove_unused_scope_block_p): Revert
	previous patch.
	(remove_unused_locals): Skip when not optimizing.

Index: gcc/tree-ssa-live.c
===================================================================
--- gcc/tree-ssa-live.c.orig	2009-05-18 21:40:36.000000000 -0300
+++ gcc/tree-ssa-live.c	2009-05-19 03:33:20.000000000 -0300
@@ -460,13 +460,6 @@ remove_unused_scope_block_p (tree scope)
 		&& ann->used)
 	unused = false;
 
-      /* Removing declarations, when we're not optimizing, is going to
-	 affect the order in which variables are expanded, causing
-	 codegen differences we ought to avoid.  We can't even remove
-	 the blocks, for the same reason.  */
-      else if (!optimize)
-	unused = false;
-
       /* When we are not doing full debug info, we however can keep around
 	 only the used variables for cfgexpand's memory packing saving quite
 	 a lot of memory.  
@@ -640,6 +633,9 @@ remove_unused_locals (void)
   var_ann_t ann;
   bitmap global_unused_vars = NULL;
 
+  if (!optimize)
+    return;
+
   mark_scope_block_unused (DECL_INITIAL (current_function_decl));
 
   /* Assume all locals are unused.  */

-- 
Alexandre Oliva, freedom fighter    http://FSFLA.org/~lxoliva/
You must be the change you wish to see in the world. -- Gandhi
Be Free! -- http://FSFLA.org/   FSF Latin America board member
Free Software Evangelist      Red Hat Brazil Compiler Engineer

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