[RFC] Enable saliasing for structs with arrays

Zdenek Dvorak rakdver@atrey.karlin.mff.cuni.cz
Thu Jul 21 10:46:00 GMT 2005


Hello,

> > > > This simple patch enables structure aliasing for structs containing
> > > > arrays (_not_ enabling subvars for the arrays).  Unfortunately, the
> > > > patch breaks bootstrap due to IVOPTs and friends.  This is sad, as
> > > > it may even help for better alias analysis for GCCs tree structure.
> > > > 
> > > > Maybe some IVOPTs folks can help out here.
> > 
> > tree-ssa-loop-ivopts.c:copy_ref_info does not handle the subvars at all,
> > currently. I will check what I can do.
> 
> For TARGET_MEM_REFs being nice to me (i.e. have a TMR_SYMBOL) I was
> able to fix the aliasing issues.  But now, f.i. for the testcase
> 
> static union {
>   char buf[100];
>   double foo;
> } u2;
> 
> extern void foobar (char *);
> main ()
> {
>   int off2, len;
>   char *p;
>   for (len = 1; len < 100; len++)
>     {
>       u2.buf[off2 + len] = '\0';
>       foobar (u2.buf + off2);
>     }
> 
>   return 0;
> }
> 
> we generate TARGET_MEM_REFs with neither TMR_SYMBOL, nor TMR_TAG for
> 'u2.buf[off2 + len] = '\0';' -- this sucks.

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.

Zdenek

> TARGET_MEM_REFs would
> fit nicely with subvars and aliasing, if they only always had all
> necessary information filled in.
> 
> Richard.



More information about the Gcc-patches mailing list