This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR66705
- From: Jan Hubicka <hubicka at ucw dot cz>
- To: Richard Biener <rguenther at suse dot de>
- Cc: Jan Hubicka <hubicka at ucw dot cz>, gcc-patches at gcc dot gnu dot org
- Date: Wed, 2 Sep 2015 16:25:05 +0200
- Subject: Re: [PATCH] Fix PR66705
- Authentication-results: sourceware.org; auth=none
- References: <alpine dot LSU dot 2 dot 11 dot 1509021456160 dot 5523 at zhemvz dot fhfr dot qr> <20150902130338 dot GA96189 at kam dot mff dot cuni dot cz> <alpine dot LSU dot 2 dot 11 dot 1509021526310 dot 5523 at zhemvz dot fhfr dot qr>
>
> 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)