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: Do less generous pointer globbing in alias.c


> > +alias_set_entry
> > +init_alias_set_entry (alias_set_type set)
> > +{
> > +  alias_set_entry ase = ggc_cleared_alloc<alias_set_entry_d> ();
> 
> no need to use cleared_alloc if you also init ->is_pointer to false.
OK, will update the patch.
> 
> > +  ase->alias_set = set;
> > +  ase->children
> > +    = hash_map<int, int, alias_set_traits>::create_ggc (64);
> 
> that seems a bit excessive, esp. for pointers which won't end
> up with any children?  So better make children lazily allocated
> in record_alias_subset.

All pointers that are not in alias set of ptr_type_node will have a child.
So there is only one childless pointer set.  I will update the code though.
> 
> I still wonder why you do this instead of changing alias_sets_conflict
> in the same way you changed alias_set_subset_of.

Because I would need two flags otherwise. One denoting alias sets that
are pointers (who needs special treatment for subset_of) and one denoting
alias set that contains pointer.

i.e. for:
struct {int *a,b;}

I need to have its alias set to contain all of setof(int), setof(int *), setof(void *).
I however do not want setof(struct {int *a,b;}) to be subset of setof(void *)

Honza
> 
> Patch looks ok otherwise but please leave the patch for others to
> comment on for a while.
> 
> Thanks,
> Richard.
> 
> > +	    }
> > +	}
> > +    }
> > +  /* In LTO the rules above needs to be part of canonical type machinery.
> > +     For now just punt.  */
> > +  else if (POINTER_TYPE_P (t) && t != ptr_type_node && in_lto_p)
> >      set = get_alias_set (ptr_type_node);
> >  
> >    /* Otherwise make a new alias set for this type.  */
> > @@ -953,6 +1052,15 @@ get_alias_set (tree t)
> >    if (AGGREGATE_TYPE_P (t) || TREE_CODE (t) == COMPLEX_TYPE)
> >      record_component_aliases (t);
> >  
> > +  /* We treat pointer types specially in alias_set_subset_of.  */
> > +  if (POINTER_TYPE_P (t) && set)
> > +    {
> > +      alias_set_entry ase = get_alias_set_entry (set);
> > +      if (!ase)
> > +	ase = init_alias_set_entry (set);
> > +      ase->is_pointer = true;
> > +    }
> > +
> >    return set;
> >  }
> >  
> > @@ -1003,12 +1111,7 @@ record_alias_subset (alias_set_type supe
> >      {
> >        /* Create an entry for the SUPERSET, so that we have a place to
> >  	 attach the SUBSET.  */
> > -      superset_entry = ggc_cleared_alloc<alias_set_entry_d> ();
> > -      superset_entry->alias_set = superset;
> > -      superset_entry->children
> > -	= hash_map<int, int, alias_set_traits>::create_ggc (64);
> > -      superset_entry->has_zero_child = 0;
> > -      (*alias_sets)[superset] = superset_entry;
> > +      superset_entry = init_alias_set_entry (superset);
> >      }
> >  
> >    if (subset == 0)
> > Index: testsuite/gcc.dg/alias-8.c
> > ===================================================================
> > --- testsuite/gcc.dg/alias-8.c	(revision 223772)
> > +++ testsuite/gcc.dg/alias-8.c	(working copy)
> > @@ -8,5 +8,5 @@ struct s {
> >  void
> >  func(struct s *ptr)
> >  {
> > -  *(void **)&ptr->p = 0; /* { dg-warning "type-punned pointer" "" { xfail *-*-* } } */
> > +  *(void **)&ptr->p = 0; /* { dg-warning "type-punned pointer" "" { } } */
> >  }
> > Index: testsuite/gcc.dg/pr62167.c
> > ===================================================================
> > --- testsuite/gcc.dg/pr62167.c	(revision 223772)
> > +++ testsuite/gcc.dg/pr62167.c	(working copy)
> > @@ -29,6 +29,8 @@ main ()
> >  
> >    node.prev = (void *)head;
> >  
> > +  asm("":"=m"(node.prev));
> > +
> >    head->first = &node;
> >  
> >    struct node *n = head->first;
> > 
> > 
> 
> -- 
> Richard Biener <rguenther@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, Dilip Upmanyu, Graham Norton, HRB 21284 (AG Nuernberg)


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