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] Fix PR47286


On Fri, 14 Jan 2011, Michael Matz wrote:

> Hi,
> 
> On Fri, 14 Jan 2011, Richard Guenther wrote:
> 
> > This fixes points-to analysis of local register variables.  We have to
> > assume that you can reach all global vars via them and that everything
> > stored to them escapes.
> 
> That is false.  We have to assume this for register variables bound to a 
> hard-reg, not for normal variables with register storage class.
> 
> > --- 413,422 ----
> >     ret->is_global_var = (t == NULL_TREE);
> >     ret->is_fn_info = false;
> >     if (t && DECL_P (t))
> > !     ret->is_global_var = (is_global_var (t)
> > ! 			  /* We have to treat even local register variables
> > ! 			     as escape points.  */
> > ! 			  || (TREE_CODE (t) == VAR_DECL && DECL_REGISTER (t)));
> 
> You want to check DECL_HARD_REGISTER.  The above would also make
> 
>   register int x;
> 
> an escape point, although this is simply a normal local variable that you 
> can't take the address of.

I have applied the following (but C doesn't seem to set DECL_HARD_REGISTER
for global reg vars).  The ME seems to use DECL_REGISTER and
DECL_HARD_REGISTER in various inconsistent ways btw ...

2011-01-14  Richard Guenther  <rguenther@suse.de>

	* tree-ssa-structalias.c  (new_var_info): Use DECL_HARD_REGISTER.

Index: gcc/tree-ssa-structalias.c
===================================================================
*** gcc/tree-ssa-structalias.c	(revision 168783)
--- gcc/tree-ssa-structalias.c	(working copy)
*************** new_var_info (tree t, const char *name)
*** 416,422 ****
      ret->is_global_var = (is_global_var (t)
  			  /* We have to treat even local register variables
  			     as escape points.  */
! 			  || (TREE_CODE (t) == VAR_DECL && DECL_REGISTER (t)));
    ret->solution = BITMAP_ALLOC (&pta_obstack);
    ret->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
    ret->next = NULL;
--- 416,423 ----
      ret->is_global_var = (is_global_var (t)
  			  /* We have to treat even local register variables
  			     as escape points.  */
! 			  || (TREE_CODE (t) == VAR_DECL
! 			      && DECL_HARD_REGISTER (t)));
    ret->solution = BITMAP_ALLOC (&pta_obstack);
    ret->oldsolution = BITMAP_ALLOC (&oldpta_obstack);
    ret->next = NULL;


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