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


On 6/6/07, Zdenek Dvorak <rakdver@kam.mff.cuni.cz> wrote:
Hello,

> Right now, we currently decide that if two base objects are not
> operand_equal_p, they must have different base objects.
>
> We can do slightly better.
>
> If the vops on the datarefs are exactly equal, they must have the same
> base object.
>
> IE:
>
> (gdb) p debug_generic_stmt (a->stmt)
> # VUSE <PARM_NOALIAS.4_22, PARM_NOALIAS.5_14, SMT.6_39> {
> PARM_NOALIAS.4 PARM_NOALIAS.5 SMT.6 }
> D.1886_24 = *D.1885_23;
>
> $1 = void
> (gdb) p debug_generic_stmt (b->stmt)
> # VUSE <PARM_NOALIAS.4_22, PARM_NOALIAS.5_14, SMT.6_39> {
> PARM_NOALIAS.4 PARM_NOALIAS.5 SMT.6 }
> D.1888_28 = *D.1887_27;
>
>
> 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. It will never say that two completely unrelated accesses are related. 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]