This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: Improve data ref disambiguation


Hello,

> >> Dereferences of these pointers can touch exactly the same memory, so
> >> they must share a base object (there is no guarantee they have the
> >> same offsets, etc, only that their pointers can only touch the same
> >> set of memory).
> >
> >is this patch really correct? The rest of code in
> >initialize_data_dependence_relation, as well as
> >compute_affine_dependence, assumes that DR_BASE_OBJECTs are exactly
> >equal).
> >
> 
> At worst, this will cause it to claim dependence where there is none.

I am not sure this is the case.  For example, consider that we have
a = {p + 1, +, 2}
b = {q, +, 2}

where both p and q point to the same array (but not necessarily the same
place).  Then

DR_BASE_OBJECT (*a) = *p, access_fn = {1,+,2}
DR_BASE_OBJECT (*b) = *q, access_fn = {0,+,2}

and compute_affine_dependence will claim that *a and *b are independent
(as it would be the case if p == q), but in fact it depends on whether
p - q is even or odd.

Zdenek

> If you know of a place that  cares whether they are exactly equal, i'd
> be happy to not commit the patch  (It actually has not been committed
> yet).
> I'd just wait for ptr-plus to merge so that we can separate out the
> base object better
> 
> The motivating example in this case is:
> void test(unsigned char * __restrict__ dst, unsigned char *
> __restrict__ row, char n) {
>    unsigned char *row0 = row;
>    unsigned char *row1 = row + n;
>    unsigned char *row2 = row + n * 2;
>    unsigned char *dst1 = dst + n;
>    for(char x = 0; x < n; x++ )  {
>        dst[x] = row0[x] + row1[x] + row2[x];
>        dst1[x] = (row1[x] + row2[x])*4;
>    }
> }
> 
> Without this patch, we refuse to determine the dependence between
> row0, row1, and row2, because they end up with different ssa_names,
> even though they have the exact same set of vuses, and can only touch
> the same memory
> 
> (gdb) p debug_generic_stmt (dra->stmt)
> # VUSE <SMT.4_31> { SMT.4 }
> D.1886_24 = *D.1885_23;
> 
> $1 = void
> (gdb) p debug_generic_stmt (drb->stmt)
> # VUSE <SMT.4_31> { SMT.4 }
> D.1888_28 = *D.1887_27;
> 
> 
> --Dan


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]