aboutsummaryrefslogtreecommitdiff
path: root/gcc/graphite-dependences.c
diff options
context:
space:
mode:
authorAditya Kumar <aditya.k7@samsung.com>2015-12-02 17:11:52 +0000
committerSebastian Pop <spop@gcc.gnu.org>2015-12-02 17:11:52 +0000
commit2e733703c0328d10098ced65abcc9803b4e5616d (patch)
tree1e81e6d67ce52610d9ca4e70944d0e99453388dd /gcc/graphite-dependences.c
parent84c36240fc2df7a749772bb02df8632c5d5acec6 (diff)
downloadgcc-2e733703c0328d10098ced65abcc9803b4e5616d.zip
gcc-2e733703c0328d10098ced65abcc9803b4e5616d.tar.gz
gcc-2e733703c0328d10098ced65abcc9803b4e5616d.tar.bz2
fix invalid bounds on array refs
While enabling graphite in -O3 we found a Fortran testcase that fails because the max of the type domain is -1. We used to add that as a constraint to the elements accessed by the array, leading to a unfeasible constraint: 0 <= i <= -1. Having that constraint, drops the data reference as that says that there are no elements accessed in the array. * graphite-dependences.c (scop_get_reads): Add extra dumps. (scop_get_must_writes): Same. (scop_get_may_writes): Same. (compute_deps): Same. * graphite-sese-to-poly.c (bounds_are_valid): New. (pdr_add_data_dimensions): Call bounds_are_valid. * gfortran.dg/graphite/run-id-3.f90: New. Co-Authored-By: Sebastian Pop <s.pop@samsung.com> From-SVN: r231191
Diffstat (limited to 'gcc/graphite-dependences.c')
-rw-r--r--gcc/graphite-dependences.c49
1 files changed, 46 insertions, 3 deletions
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index fcc771b..bb81ae3 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -87,7 +87,11 @@ scop_get_reads (scop_p scop, vec<poly_bb_p> pbbs)
{
FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr)
if (pdr_read_p (pdr))
- res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb));
+ {
+ if (dump_file)
+ print_pdr (dump_file, pdr);
+ res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb));
+ }
}
return res;
@@ -108,7 +112,11 @@ scop_get_must_writes (scop_p scop, vec<poly_bb_p> pbbs)
{
FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr)
if (pdr_write_p (pdr))
- res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb));
+ {
+ if (dump_file)
+ print_pdr (dump_file, pdr);
+ res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb));
+ }
}
return res;
@@ -129,7 +137,12 @@ scop_get_may_writes (scop_p scop, vec<poly_bb_p> pbbs)
{
FOR_EACH_VEC_ELT (PBB_DRS (pbb), j, pdr)
if (pdr_may_write_p (pdr))
- res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb));
+ {
+ if (dump_file)
+ print_pdr (dump_file, pdr);
+
+ res = isl_union_map_add_map (res, add_pdr_constraints (pdr, pbb));
+ }
}
return res;
@@ -313,6 +326,36 @@ compute_deps (scop_p scop, vec<poly_bb_p> pbbs,
isl_union_map *empty = isl_union_map_empty (space);
isl_union_map *original = scop_get_original_schedule (scop, pbbs);
+ if (dump_file)
+ {
+ fprintf (dump_file, "\n--- Documentation for datarefs dump: ---\n");
+ fprintf (dump_file, "Statements on the iteration domain are mapped to"
+ " array references.\n");
+ fprintf (dump_file, " To read the following data references:\n\n");
+ fprintf (dump_file, " S_5[i0] -> [106] : i0 >= 0 and i0 <= 3\n");
+ fprintf (dump_file, " S_8[i0] -> [1, i0] : i0 >= 0 and i0 <= 3\n\n");
+
+ fprintf (dump_file, " S_5[i0] is the dynamic instance of statement"
+ " bb_5 in a loop that accesses all iterations 0 <= i0 <= 3.\n");
+ fprintf (dump_file, " [1, i0] is a 'memref' with alias set 1"
+ " and first subscript access i0.\n");
+ fprintf (dump_file, " [106] is a 'scalar reference' which is the sum of"
+ " SSA_NAME_VERSION 6"
+ " and --param graphite-max-arrays-per-scop=100\n");
+ fprintf (dump_file, "-----------------------\n\n");
+
+ fprintf (dump_file, "data references (\n");
+ fprintf (dump_file, " reads: ");
+ print_isl_union_map (dump_file, reads);
+ fprintf (dump_file, " must_writes: ");
+ print_isl_union_map (dump_file, must_writes);
+ fprintf (dump_file, " may_writes: ");
+ print_isl_union_map (dump_file, may_writes);
+ fprintf (dump_file, " all_writes: ");
+ print_isl_union_map (dump_file, all_writes);
+ fprintf (dump_file, ")\n");
+ }
+
isl_union_map_compute_flow (isl_union_map_copy (reads),
isl_union_map_copy (must_writes),
isl_union_map_copy (may_writes),