Message ID | 570757AE.7070306@mentor.com |
---|---|
State | New |
Headers | show |
On Fri, Apr 8, 2016 at 2:03 AM, Tom de Vries <Tom_deVries@mentor.com> wrote: > pdr_0 (read > in gimple stmt: _9 = yu[_8][0]; > data accesses: { S_4[i1, i2] -> [1, 0, 1 + i1] } data access should be { S_4[i1, i2] -> [1, 1 + i1, 0] } > subscript sizes: { [1, i1, 0] : i1 >= 0 and i1 <= 3 } > ) [...] > I'm not really sure how this is supposed to be fixed. I imagine that we should do one of 3: > 1. we change the order in the access functions > 2. we change the order in the subscript_sizes > 3. we keep the orders as they are, but don't intersect them directly > but do an order inversion before. > > I've picked 1, since that was the easiest for me to implement (but I'm not sure if by doing so, I've broken any hardcoded graphite assumptions). 1 is the right fix: both access functions and subscript sizes should be in the same order. If Richi agrees, ok to commit. Thanks, Sebastian
On April 9, 2016 6:07:19 AM GMT+02:00, Sebastian Pop <sebpop@gmail.com> wrote: >On Fri, Apr 8, 2016 at 2:03 AM, Tom de Vries <Tom_deVries@mentor.com> >wrote: >> pdr_0 (read >> in gimple stmt: _9 = yu[_8][0]; >> data accesses: { S_4[i1, i2] -> [1, 0, 1 + i1] } > >data access should be { S_4[i1, i2] -> [1, 1 + i1, 0] } > >> subscript sizes: { [1, i1, 0] : i1 >= 0 and i1 <= 3 } >> ) >[...] >> I'm not really sure how this is supposed to be fixed. I imagine that >we should do one of 3: >> 1. we change the order in the access functions >> 2. we change the order in the subscript_sizes >> 3. we keep the orders as they are, but don't intersect them directly >> but do an order inversion before. >> >> I've picked 1, since that was the easiest for me to implement (but >I'm not sure if by doing so, I've broken any hardcoded graphite >assumptions). > >1 is the right fix: both access functions and subscript sizes should >be in the same order. >If Richi agrees, ok to commit. OK. Richard. >Thanks, >Sebastian
Fix pdr accesses order 2016-04-07 Tom de Vries <tom@codesourcery.com> PR tree-optimization/68953 * graphite-sese-to-poly.c (pdr_add_memory_accesses): Order accesses from first to last subscript. * gcc.dg/graphite/pr68953.c: New test. --- gcc/graphite-sese-to-poly.c | 2 +- gcc/testsuite/gcc.dg/graphite/pr68953.c | 30 ++++++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c index b62789f8..22a09a1 100644 --- a/gcc/graphite-sese-to-poly.c +++ b/gcc/graphite-sese-to-poly.c @@ -672,7 +672,7 @@ pdr_add_memory_accesses (isl_map *acc, dr_info &dri) aff = extract_affine (scop, afn, isl_space_domain (isl_map_get_space (acc))); - acc = set_index (acc, i + 1, aff); + acc = set_index (acc, nb_subscripts - i , aff); } return isl_map_coalesce (acc); diff --git a/gcc/testsuite/gcc.dg/graphite/pr68953.c b/gcc/testsuite/gcc.dg/graphite/pr68953.c new file mode 100644 index 0000000..12c632d --- /dev/null +++ b/gcc/testsuite/gcc.dg/graphite/pr68953.c @@ -0,0 +1,30 @@ +/* { dg-do run } */ +/* { dg-options "-O1 -floop-nest-optimize" } */ + +extern void abort (void); + +int yu[4][1] = { { 1 }, { 2 }, { 3 }, { 4 } }; + +static void __attribute__((noinline,noclone)) +foo (void) +{ + int zh, ro; + + for (zh = 0; zh < 2; ++zh) + for (ro = 0; ro < 3; ++ro) + yu[ro][0] = yu[zh + 1][0]; +} + +int +main (void) +{ + foo (); + + if (yu[0][0] != 2 + || yu[1][0] != 2 + || yu[2][0] != 2 + || yu[3][0] != 4) + abort (); + + return 0; +}