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: [PATCH][4/n] referenced-vars TLC


On Wed, 23 May 2012, H.J. Lu wrote:

> On Wed, May 23, 2012 at 7:25 AM, H.J. Lu <hjl.tools@gmail.com> wrote:
> > On Wed, May 23, 2012 at 5:00 AM, Richard Guenther <rguenther@suse.de> wrote:
> >>
> >> This finally switches us to not record global vars in referenced-vars.
> >> For this to work I had to re-engineer how we handle global var removal
> >> from local-decls in remove_unused_locals. ?Incidentially that code
> >> already had some sort of a bitmap (for some weird reason even), thus
> >> I borrowed that and simplified the handling. ?You may notice that
> >> it would be easy to handle all vars that way ...
> >>
> >> So eventually 5/n will make referenced-vars go away completely
> >> (the only serious user seems to be the SSA renamer for its
> >> SYMS_TO_RENAME bitmap).
> >>
> >> Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.
> >>
> >> Richard.
> >>
> >> 2012-05-23 ?Richard Guenther ?<rguenther@suse.de>
> >>
> >> ? ? ? ?* tree-dfa.c (add_referenced_var_1): Do not add global vars.
> >> ? ? ? ?* tree-ssa-live.c (mark_all_vars_used_1): Handle global vars
> >> ? ? ? ?via the global_unused_vars bitmap.
> >> ? ? ? ?(remove_unused_locals): Handle global vars in local-decls via
> >> ? ? ? ?a global_unused_vars bitmap instead of the used flag in the
> >> ? ? ? ?var annotation. ?Simplify global variable handling and removal.
> >>
> >
> > This breaks bootstrap on Linux/x86-64:
> >
> > http://gcc.gnu.org/ml/gcc-regression/2012-05/msg00468.html
> >
> > Comparing stages 2 and 3
> > warning: gcc/cc1plus-checksum.o differs
> > warning: gcc/cc1obj-checksum.o differs
> > warning: gcc/cc1-checksum.o differs
> > Bootstrap comparison failure!
> > gcc/trans-mem.o differs
> > gcc/gimple-low.o differs
> > gcc/sese.o differs
> > make[5]: *** [compare] Error 1
> >
> > Please make sure that your compiler used for bootstrap
> > doesn't add anything to .comment section, which will
> > disable debug compare.
> 
> I opened:
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53466

I am testing the following (or it will reproduce hopefully, with
--with-build-config=bootstrap-debug).  Why can't compare-debug ignore
comment sections?

Thanks,
Richard.

2012-05-24  Richard Guenther  <rguenther@suse.de>

	PR bootstrap/53466
	* tree-ssa-live.c (remove_unused_scope_block_p): Properly
	handle globals.
	(remove_unused_locals): Pass global_unused_vars to
	remove_unused_scope_block_p.

Index: gcc/tree-ssa-live.c
===================================================================
--- gcc/tree-ssa-live.c	(revision 187800)
+++ gcc/tree-ssa-live.c	(working copy)
@@ -429,7 +429,7 @@ mark_scope_block_unused (tree scope)
    done by the inliner.  */
 
 static bool
-remove_unused_scope_block_p (tree scope)
+remove_unused_scope_block_p (tree scope, bitmap global_unused_vars)
 {
   tree *t, *next;
   bool unused = !TREE_USED (scope);
@@ -472,7 +472,9 @@ 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 (var_ann (*t) != NULL && is_used_p (*t))
+      else if ((is_global_var (*t)
+		&& !bitmap_bit_p (global_unused_vars, DECL_UID (*t)))
+	       || (var_ann (*t) != NULL && is_used_p (*t)))
 	unused = false;
       else if (TREE_CODE (*t) == LABEL_DECL && TREE_USED (*t))
 	/* For labels that are still used in the IL, the decision to
@@ -517,7 +519,7 @@ remove_unused_scope_block_p (tree scope)
     }
 
   for (t = &BLOCK_SUBBLOCKS (scope); *t ;)
-    if (remove_unused_scope_block_p (*t))
+    if (remove_unused_scope_block_p (*t, global_unused_vars))
       {
 	if (BLOCK_SUBBLOCKS (*t))
 	  {
@@ -847,9 +849,12 @@ remove_unused_locals (void)
     }
   if (dstidx != num)
     VEC_truncate (tree, cfun->local_decls, dstidx);
+
+  remove_unused_scope_block_p (DECL_INITIAL (current_function_decl),
+			       global_unused_vars);
+
   BITMAP_FREE (global_unused_vars);
 
-  remove_unused_scope_block_p (DECL_INITIAL (current_function_decl));
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
       fprintf (dump_file, "Scope blocks after cleanups:\n");

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