[RFC] ignoring type alias conflicts between structures and scalars

Diego Novillo dnovillo@redhat.com
Thu Nov 25 16:53:00 GMT 2004


On Thu, 2004-11-25 at 11:22 -0500, Richard Kenner wrote:

> If I have two pointers, one to struct_int_float and one to int, it's
> certainly the case that a store into one can affect what's pointed to by the
> other and that's what the alias set conflict is trying to address.
> 
No, we have one pointer and one regular variable.  I understand that an
'int *' may point to a field of 'struct int_float_s'.

> So what *exactly* are you trying to test?
> 
It's in my original message.  Given:

struct int_float_s {
   int i;
   int f;
};

int X;

foo()
{
   struct int_float_s *x = bar();
   X = 10;
   x->i = 3;
   return X;
}

I don't want to consider 'X = 10' and 'x->i = 3' to be stores to the
same memory location.  That is, I want the optimizers to assume that
pointer 'x' cannot possibly be pointing to 'X'.

At the moment, the fact that 'struct int_float_s' conflicts with 'int'
causes us to think that 'x' may point to 'X'.

So, what I want to teach the alias analyzer is that given a pointer to
an aggregate type A and a regular variable of a scalar type S, such that
A and S are not type-compatible, then a pointer to 'A' cannot possibly
point to a variable of type 'S'.

So, it boils down to alias_sets_conflict_p being symmetric.  We want to
consider 'int * -> struct int_float_s' to alias, but we want to reject
'struct int_float_s * -> int'.


Diego.



More information about the Gcc mailing list