This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How could I get alias set information from data_reference_p
On Tue, Jul 14, 2009 at 11:12 AM, Li Feng<nemokingdom@gmail.com> wrote:
> Hi Richard,
> On Tue, Jul 14, 2009 at 4:54 PM, Richard
> Guenther<richard.guenther@gmail.com> wrote:
>> On Tue, Jul 14, 2009 at 8:01 AM, Li Feng<nemokingdom@gmail.com> wrote:
>>> Hi,
>>>
>>> I'm now working on Graphite branch and need to know
>>> the alias set information for each data_reference_p, which
>>> would be an integer (or alias_set_type) stands for which
>>> alias set it is in.
>>>
>>> I tried to get the alias set information with get_alias_set (tree)
>>> (I've no idea how this function works, just a experimental
>>> trying), for my testcase, it returns 2 for all the
>>> data_reference_p->ref, which I think is unreasonable.
>>> So I think I may go wrong somewhere.
>>>
>>> The question will be: how could I get it's relevant
>>> alias set information from data_reference_p?
>>>
>>> p.s. :
>>> In Graphite, the data reference was built for each
>>> gimple stmt with:
>>> get_references_in_stmt (stmt, &references);
>>> then for each ref in references, data reference is created with:
>>> dr = create_data_ref (nest, *ref->pos, stmt, ref->is_read);
>>
>> get_alias_set (dr->ref) is the correct thing. ?Why do you think it
>> is unreasonable to return 2 for all of them? ?Why do you need
>> alias-set information anyway?
>
> The testcase looks like this, where I assume that
> p and a in the same alias set, while q and Q in another, and so on.
> But between them, the alias set number ?should be different, otherwise
> maybe I misunderstood somewhere about the alias set.
>
> int Q[10];
>
> int foo()
> {
> ?int i;
> ?int a[10], b[20];
> ?int *p = a;
> ?int *q = Q;
>
> ?for (i = 0; i < 10; i++)
> ? ?{
> ? ? ?p[i] = i;
> ? ? ?a[i]= i - 5;
> ? ? ?b[i] = i*i;
> ? ? ?q[i] = 5;
> ? ?}
>
> ?return Q[3]*a[2]*b[10];
> }
You misunderstood what alias-set numbers represent. Alias-set
numbers encode type-based alias information only - which in
your case cannot disambiguate a or Q.
> For you question,
> We are using this information before dependency checking under
> polyhedron, if 2 data references get different dimensions and they
> are not in the same alias set, we could conclude that they
> takes no dependency.
For dependency checking you should use the dependence
checking routines or query the alias-oracle.
Richard.
> Li
>