summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAbderrazek Zaafrani <a.zaafrani@samsung.com>2015-11-07 01:32:27 +0000
committerSebastian Pop <spop@gcc.gnu.org>2015-11-07 01:32:27 +0000
commit0473915e63175064c9b6c739841bc670c782cdbd (patch)
tree32104e688dc8f9ffb5f432b9e2a565d4fdc3e700 /gcc
parent504fbc11f43fd20c33e5c44cc626f339f6fd8f8d (diff)
add original schedule to scop
* graphite-optimize-isl.c (optimize_isl): Call isl_union_map_is_equal. * graphite-poly.c (new_scop): Initialize original_schedule. (free_scop): Free original_schedule. * graphite-poly.h (struct scop): Add field original_schedule. * graphite-sese-to-poly.c (build_scop_original_schedule): New. (build_poly_scop): Call build_scop_original_schedule. From-SVN: r229910
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/graphite-optimize-isl.c20
-rw-r--r--gcc/graphite-poly.c2
-rw-r--r--gcc/graphite-poly.h3
-rw-r--r--gcc/graphite-sese-to-poly.c50
5 files changed, 80 insertions, 4 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index bac7eb87199..90fbe5f4664 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,14 @@
2015-11-06 Abderrazek Zaafrani <a.zaafrani@samsung.com>
+ * graphite-optimize-isl.c (optimize_isl): Call isl_union_map_is_equal.
+ * graphite-poly.c (new_scop): Initialize original_schedule.
+ (free_scop): Free original_schedule.
+ * graphite-poly.h (struct scop): Add field original_schedule.
+ * graphite-sese-to-poly.c (build_scop_original_schedule): New.
+ (build_poly_scop): Call build_scop_original_schedule.
+
+2015-11-06 Abderrazek Zaafrani <a.zaafrani@samsung.com>
+
* graphite-sese-to-poly.c (build_pbb_scattering_polyhedrons): Remove.
(build_pbb_minimal_scattering_polyhedrons): New.
(build_scop_scattering): Remove.
diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c
index 0d859759da1..c09264bf093 100644
--- a/gcc/graphite-optimize-isl.c
+++ b/gcc/graphite-optimize-isl.c
@@ -441,11 +441,23 @@ optimize_isl (scop_p scop)
#else
isl_union_map *schedule_map = get_schedule_map (schedule);
#endif
- apply_schedule_map_to_scop (scop, schedule_map);
- isl_schedule_free (schedule);
- isl_union_map_free (schedule_map);
- return true;
+ if (isl_union_map_is_equal (scop->original_schedule, schedule_map))
+ {
+ if (dump_file && dump_flags)
+ fprintf (dump_file, "\nISL schedule same as original schedule\n");
+
+ isl_schedule_free (schedule);
+ isl_union_map_free (schedule_map);
+ return false;
+ }
+ else
+ {
+ apply_schedule_map_to_scop (scop, schedule_map);
+ isl_schedule_free (schedule);
+ isl_union_map_free (schedule_map);
+ return true;
+ }
}
#endif /* HAVE_isl */
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 2aa40c055d8..36c3061f618 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -305,6 +305,7 @@ new_scop (edge entry, edge exit)
scop->must_waw_no_source = NULL;
scop->may_waw_no_source = NULL;
scop_set_region (scop, region);
+ scop->original_schedule = NULL;
scop->pbbs.create (3);
scop->poly_scop_p = false;
scop->drs.create (3);
@@ -341,6 +342,7 @@ free_scop (scop_p scop)
isl_union_map_free (scop->may_waw);
isl_union_map_free (scop->must_waw_no_source);
isl_union_map_free (scop->may_waw_no_source);
+ isl_union_map_free (scop->original_schedule);
XDELETE (scop);
}
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 5298f8547f9..b35431ae59d 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -436,6 +436,9 @@ struct scop
*must_war, *may_war, *must_war_no_source, *may_war_no_source,
*must_waw, *may_waw, *must_waw_no_source, *may_waw_no_source;
+ /* Original schedule of the SCoP. */
+ isl_union_map *original_schedule;
+
/* True when the scop has been converted to its polyhedral
representation. */
bool poly_scop_p;
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 394a281a97e..ba45199a02a 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -426,6 +426,55 @@ build_scop_minimal_scattering (scop_p scop)
isl_aff_free (static_sched);
}
+/* Build the original schedule showing the orginal order of execution
+ of statement instances.
+
+ The following example shows the original schedule:
+
+ for (i: ...)
+ {
+ for (j: ...)
+ {
+ A
+ }
+ B
+ }
+ C
+ for (i: ...)
+ {
+ D
+ }
+
+ Static schedules for A to D expressed in a union map:
+
+ { S_A[i0, i1] -> [i0, i1]; S_B[i0] -> [i0]; S_C[] -> []; S_9[i0] -> [i0] }
+
+*/
+
+static void
+build_scop_original_schedule (scop_p scop)
+{
+ isl_space *space = isl_set_get_space (scop->param_context);
+ isl_union_map *res = isl_union_map_empty (space);
+
+ int i;
+ poly_bb_p pbb;
+ FOR_EACH_VEC_ELT (scop->pbbs, i, pbb)
+ {
+ int nb_dimensions = isl_set_dim (pbb->domain, isl_dim_set);
+ isl_space *dc = isl_set_get_space (pbb->domain);
+ isl_space *dm = isl_space_add_dims (isl_space_from_domain (dc),
+ isl_dim_out, nb_dimensions);
+ isl_map *mp = isl_map_universe (dm);
+ for (int i = 0; i < nb_dimensions; i++)
+ mp = isl_map_equate (mp, isl_dim_in, i, isl_dim_out, i);
+
+ res = isl_union_map_add_map (res, mp);
+ }
+ scop->original_schedule = res;
+}
+
+
static isl_pw_aff *extract_affine (scop_p, tree, __isl_take isl_space *space);
/* Extract an affine expression from the chain of recurrence E. */
@@ -1799,6 +1848,7 @@ build_poly_scop (scop_p scop)
build_scop_drs (scop);
build_scop_minimal_scattering (scop);
+ build_scop_original_schedule (scop);
/* This SCoP has been translated to the polyhedral
representation. */