[RFC] Enable saliasing for structs with arrays

Jan Hubicka hubicka@ucw.cz
Thu Jul 21 14:44:00 GMT 2005


> On Thu, 21 Jul 2005, Zdenek Dvorak wrote:
> 
> > Hello,
> > 
> > > > this does not suck, this is plain wrong.  TMR_SYMBOL has absolutely
> > > > nothing to do with alias analysis.  The only place from where alias
> > > > information for TARGET_MEM_REFs can be taken is TMR_TAG; and
> > > > unfortunately the way alias information for subvars is represented
> > > > is more or less incompatible with the way alias info is represented
> > > > for all other types of memory references, which makes it hard to adapt.
> > > 
> > > Ok, here's what I have now - it miscompiles stage2 though, testing with
> > > the stage1 compiler is in progress.  Maybe you can see something
> > > obviously wrong with my approach.
> > 
> > >   static tree
> > > ! get_ref_tag (tree ref_)
> > >   {
> > > !   tree var = get_base_address (ref_);
> > > !   unsigned HOST_WIDE_INT offset, size;
> > > !   tree ref = okay_component_ref_for_subvars (ref_, &offset, &size);
> > >     tree tag;
> > >   
> > > +   if (ref)
> > > +     {
> > > +       subvar_t svars = get_subvars_for_var (ref);
> > > +       subvar_t sv;
> > > +       for (sv = svars; sv; sv = sv->next)
> > > +         {
> > > +           bool exact;
> > > +           if (overlap_subvar (offset, size, sv, &exact)
> > > + 	      && exact)
> > > + 	    return sv->var;
> > > +         }
> > > +     }
> > 
> > it may happen that more than one subvar must be taken into account here.
> > The code as it is here might be more or less OK, because you check
> > exact, but I am not really sure about it -- is this correct with unions?
> > But in any case you may happen to lose alias info here, which I do not
> > want to happen.
> 
> For unions we don't create subvars, as is, I'm looking for an exact
Has that changed with your patch?
I quite definitly was debugging some issues with subvars on unions ;)

Honza



More information about the Gcc-patches mailing list