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: [tree-ssa] live analysis on local static functions


> > On Thu, Oct 16, 2003 at 09:36:44AM +0200, Jan Hubicka wrote:
> > > This is no fun.  THere are number of functions in reload inlined because
> > > they are called once and apparently one of them kills datastructures
> > > (reload fails in the final sanity check on frame offsets to match again
> > > only on compiling large function - it is able to get trought half of
> > > stage3)
> > 
> > Didn't you say you have a patch that makes things work again?
> 
> I made patch to work around the unreferenced symbol problem (I am just
> testing more proper fix but it is equivaelnt in the functionality on C
> bootstrap), but still I get failures later in the process
> when I enable unit-at-a-time.

Hi,
the attached patch seems to do the job for static variables.  It bootstraps and
pass testing with current tree-ssa snashot.  With additional patch to re-enable
unit-at-a-time we get uninitialized variables warnings and when I get across
that genconstants of stage2 dies.  This is new failure and I will try to look
into it unless someone beats me :)

static inline char * test()
{
  static char *a="";
  return a;
}
char * q()
{
return test();
}
void main()
{
  return 0;
}

OK?
Honza

Fri Oct 17 09:17:00 CEST 2003  Jan Hubicka  <jh@suse.cz>
	* tree-cfg.c (remove_useless_stmts_and_vars_bind): Deal properly with
	local static variables.
Index: tree-cfg.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-cfg.c,v
retrieving revision 1.1.4.176
diff -c -3 -p -r1.1.4.176 tree-cfg.c
*** tree-cfg.c	14 Oct 2003 17:31:33 -0000	1.1.4.176
--- tree-cfg.c	17 Oct 2003 07:16:50 -0000
*************** remove_useless_stmts_and_vars_bind (tree
*** 1378,1402 ****
  	   vars = TREE_CHAIN (vars))
  	{
  	  struct var_ann_d *ann;
  
  	  /* We could have function declarations and the like
! 	     on this list.  Ignore them.  */
! 	  if (TREE_CODE (vars) != VAR_DECL)
  	    {
  	      prev_var = vars;
  	      continue;
  	    }
  
  	  /* Remove all unused, unaliased temporaries.  Also remove
  	     unused, unaliased local variables during highly
  	     optimizing compilations.  */
! 	  ann = var_ann (vars);
  	  if (ann
  	      && ! ann->may_aliases
  	      && ! ann->used
  	      && ! ann->has_hidden_use
! 	      && ! TREE_ADDRESSABLE (vars)
! 	      && (DECL_ARTIFICIAL (vars) || optimize >= 2))
  	    {
  	      /* Remove the variable from the BLOCK structures.  */
  	      if (block)
--- 1378,1410 ----
  	   vars = TREE_CHAIN (vars))
  	{
  	  struct var_ann_d *ann;
+ 	  tree  var = vars;
  
  	  /* We could have function declarations and the like
! 	     on this list.  Ignore them.  Also we do not deal with
! 	     static variables yet.   */
! 	  if (TREE_CODE (var) != VAR_DECL)
  	    {
  	      prev_var = vars;
  	      continue;
  	    }
  
+ 	  /* Unlike for normal expressions, the tree-inline duplicates
+ 	     static variables for BIND_EXPR in order to get debug info right.
+ 	     We must work out the original expression.  */
+ 	  if (TREE_STATIC (var) && DECL_ABSTRACT_ORIGIN (var))
+ 	    var = DECL_ABSTRACT_ORIGIN (var);
+ 
  	  /* Remove all unused, unaliased temporaries.  Also remove
  	     unused, unaliased local variables during highly
  	     optimizing compilations.  */
! 	  ann = var_ann (var);
  	  if (ann
  	      && ! ann->may_aliases
  	      && ! ann->used
  	      && ! ann->has_hidden_use
! 	      && ! TREE_ADDRESSABLE (var)
! 	      && (DECL_ARTIFICIAL (var) || optimize >= 2))
  	    {
  	      /* Remove the variable from the BLOCK structures.  */
  	      if (block)


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