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 PR66705


> 
> Hmm, no, ipa-ref list should be enough (unless we start field-sensitive
> analysis or need NULL inits for correctness).  Still have to figure out
> how to walk the list and how the reference would look like (what
> is ref->use?  IPA_REF_ADDR?  can those be speculative?)

Yep, it should be IPA_REF_ADDR.  If you do not check for that, you will
probably also trip IPA_REF_ALIAS as dereference (which would lead to missed
optimization).  If we go field sensitive, we may want to extend ipa references
anyway - that would be useful for ipa-reference and other stuff, too.

Honza
> 
> Richard.
> 
> > > 
> > > Thanks,
> > > Richard.
> > > 
> > > 2015-09-02  Richard Biener  <rguenther@suse.de>
> > > 
> > > 	PR ipa/66705
> > > 	* tree-ssa-structalias.c (ctor_for_analysis): New function.
> > > 	(create_variable_info_for_1): Use ctor_for_analysis instead
> > > 	of get_constructor.
> > > 	(create_variable_info_for): Likewise.
> > 
> > Otherwise I would go for making ctor_for_analysis a method of varpool_node and...
> > > 
> > > 	* g++.dg/lto/pr66705_0.C: New testcase.
> > > 
> > > Index: gcc/tree-ssa-structalias.c
> > > ===================================================================
> > > --- gcc/tree-ssa-structalias.c	(revision 227207)
> > > +++ gcc/tree-ssa-structalias.c	(working copy)
> > > @@ -5637,6 +5637,26 @@ check_for_overlaps (vec<fieldoff_s> fiel
> > >    return false;
> > >  }
> > >  
> > > +/* We can't use ctor_for_folding as that only returns constant constructors.  */
> > > +
> > > +static tree
> > > +ctor_for_analysis (tree decl)
> > > +{
> > > +  varpool_node *node = varpool_node::get (decl);
> > > +  if (!node)
> > > +    return error_mark_node;
> > > +  node = node->ultimate_alias_target ();
> > > +  if (DECL_INITIAL (node->decl) != error_mark_node
> > > +      || !in_lto_p)
> > > +    return (DECL_INITIAL (node->decl)
> > > +	    ? DECL_INITIAL (node->decl) : error_mark_node);
> > 
> > I think returning NULL here is just fine. 
> > error_mark_node means constructor is not really available. NULL is
> > the usual way to say that the variable is not initialized.
> > 
> > 
> 
> -- 
> Richard Biener <rguenther@suse.de>
> SUSE LINUX GmbH, GF: Felix Imendoerffer, Jane Smithard, 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]