Removed the member variables which are only used in scop_get_dependence. Instead only maintaining the overall dependence. Passes regtest and bootstrap.
gcc/ChangeLog: 2015-12-15 hiraditya <hiradi...@msn.com> * graphite-dependences.c (scop_get_dependences): Use local pointers. * graphite-isl-ast-to-gimple.c(translate_isl_ast_to_gimple::scop_to_isl_ast): Use scop->dependence. * graphite-optimize-isl.c (optimize_isl): Same. * graphite-poly.c (new_scop): Remove initialization of removed members. (free_scop): Same. * graphite.h (struct scop): Remove individial dependence pointers and add a scop::dependence to contain all the dependence. --- gcc/graphite-dependences.c | 56 ++++++++++++++++++++++++---------------- gcc/graphite-isl-ast-to-gimple.c | 7 ++--- gcc/graphite-optimize-isl.c | 12 ++++----- gcc/graphite-poly.c | 43 ++++++++---------------------- gcc/graphite.h | 9 ++----- 5 files changed, 55 insertions(+), 72 deletions(-) diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c index bb81ae3..b34ed77 100644 --- a/gcc/graphite-dependences.c +++ b/gcc/graphite-dependences.c @@ -376,28 +376,32 @@ compute_deps (scop_p scop, vec<poly_bb_p> pbbs, isl_union_map * scop_get_dependences (scop_p scop) { - isl_union_map *dependences; - - if (!scop->must_raw) - compute_deps (scop, scop->pbbs, - &scop->must_raw, &scop->may_raw, - &scop->must_raw_no_source, &scop->may_raw_no_source, - &scop->must_war, &scop->may_war, - &scop->must_war_no_source, &scop->may_war_no_source, - &scop->must_waw, &scop->may_waw, - &scop->must_waw_no_source, &scop->may_waw_no_source); - - dependences = isl_union_map_copy (scop->must_raw); - dependences = isl_union_map_union (dependences, - isl_union_map_copy (scop->must_war)); - dependences = isl_union_map_union (dependences, - isl_union_map_copy (scop->must_waw)); - dependences = isl_union_map_union (dependences, - isl_union_map_copy (scop->may_raw)); - dependences = isl_union_map_union (dependences, - isl_union_map_copy (scop->may_war)); - dependences = isl_union_map_union (dependences, - isl_union_map_copy (scop->may_waw)); + if (scop->dependence) + return scop->dependence; + + /* The original dependence relations: + RAW are read after write dependences, + WAR are write after read dependences, + WAW are write after write dependences. */ + isl_union_map *must_raw = NULL, *may_raw = NULL, *must_raw_no_source = NULL, + *may_raw_no_source = NULL, *must_war = NULL, *may_war = NULL, + *must_war_no_source = NULL, *may_war_no_source = NULL, *must_waw = NULL, + *may_waw = NULL, *must_waw_no_source = NULL, *may_waw_no_source = NULL; + + compute_deps (scop, scop->pbbs, + &must_raw, &may_raw, + &must_raw_no_source, &may_raw_no_source, + &must_war, &may_war, + &must_war_no_source, &may_war_no_source, + &must_waw, &may_waw, + &must_waw_no_source, &may_waw_no_source); + + isl_union_map *dependences = must_raw; + dependences = isl_union_map_union (dependences, must_war); + dependences = isl_union_map_union (dependences, must_waw); + dependences = isl_union_map_union (dependences, may_raw); + dependences = isl_union_map_union (dependences, may_war); + dependences = isl_union_map_union (dependences, may_waw); if (dump_file) { @@ -406,6 +410,14 @@ scop_get_dependences (scop_p scop) fprintf (dump_file, ")\n"); } + isl_union_map_free (must_raw_no_source); + isl_union_map_free (may_raw_no_source); + isl_union_map_free (must_war_no_source); + isl_union_map_free (may_war_no_source); + isl_union_map_free (must_waw_no_source); + isl_union_map_free (may_waw_no_source); + + scop->dependence = dependences; return dependences; } diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index ed2a896..af54109 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -3203,18 +3203,15 @@ translate_isl_ast_to_gimple::scop_to_isl_ast (scop_p scop, ivs_params &ip) isl_union_map *schedule_isl = generate_isl_schedule (scop); isl_ast_build *context_isl = generate_isl_context (scop); context_isl = set_options (context_isl, schedule_isl); - isl_union_map *dependences = NULL; if (flag_loop_parallelize_all) { - dependences = scop_get_dependences (scop); + isl_union_map *dependence = scop_get_dependences (scop); context_isl = isl_ast_build_set_before_each_for (context_isl, ast_build_before_for, - dependences); + dependence); } isl_ast_node *ast_isl = isl_ast_build_ast_from_schedule (context_isl, schedule_isl); - if (dependences) - isl_union_map_free (dependences); isl_ast_build_free (context_isl); return ast_isl; } diff --git a/gcc/graphite-optimize-isl.c b/gcc/graphite-optimize-isl.c index 0ae5656..f0a3025 100644 --- a/gcc/graphite-optimize-isl.c +++ b/gcc/graphite-optimize-isl.c @@ -380,12 +380,12 @@ optimize_isl (scop_p scop) isl_options_set_on_error (scop->isl_context, ISL_ON_ERROR_CONTINUE); isl_union_set *domain = scop_get_domains (scop); - isl_union_map *dependences = scop_get_dependences (scop); - dependences - = isl_union_map_gist_domain (dependences, isl_union_set_copy (domain)); - dependences - = isl_union_map_gist_range (dependences, isl_union_set_copy (domain)); - isl_union_map *validity = dependences; + scop_get_dependences (scop); + scop->dependence + = isl_union_map_gist_domain (scop->dependence, isl_union_set_copy (domain)); + scop->dependence + = isl_union_map_gist_range (scop->dependence, isl_union_set_copy (domain)); + isl_union_map *validity = isl_union_map_copy (scop->dependence); isl_union_map *proximity = isl_union_map_copy (validity); #ifdef HAVE_ISL_SCHED_CONSTRAINTS_COMPUTE_SCHEDULE diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index f4bdd40..25aff8a 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -290,26 +290,15 @@ scop_p new_scop (edge entry, edge exit) { sese_info_p region = new_sese_info (entry, exit); - scop_p scop = XNEW (struct scop); - - scop->param_context = NULL; - scop->must_raw = NULL; - scop->may_raw = NULL; - scop->must_raw_no_source = NULL; - scop->may_raw_no_source = NULL; - scop->must_war = NULL; - scop->may_war = NULL; - scop->must_war_no_source = NULL; - scop->may_war_no_source = NULL; - scop->must_waw = NULL; - scop->may_waw = NULL; - scop->must_waw_no_source = NULL; - scop->may_waw_no_source = NULL; - scop_set_region (scop, region); - scop->pbbs.create (3); - scop->drs.create (3); - - return scop; + scop_p s; + s = XNEW (struct scop); + + s->param_context = NULL; + scop_set_region (s, region); + s->pbbs.create (3); + s->drs.create (3); + s->dependence = NULL; + return s; } /* Deletes SCOP. */ @@ -330,18 +319,8 @@ free_scop (scop_p scop) scop->drs.release (); isl_set_free (scop->param_context); - isl_union_map_free (scop->must_raw); - isl_union_map_free (scop->may_raw); - isl_union_map_free (scop->must_raw_no_source); - isl_union_map_free (scop->may_raw_no_source); - isl_union_map_free (scop->must_war); - isl_union_map_free (scop->may_war); - isl_union_map_free (scop->must_war_no_source); - isl_union_map_free (scop->may_war_no_source); - isl_union_map_free (scop->must_waw); - 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->dependence); + scop->dependence = NULL; XDELETE (scop); } diff --git a/gcc/graphite.h b/gcc/graphite.h index c7589ba..9d95ca9 100644 --- a/gcc/graphite.h +++ b/gcc/graphite.h @@ -410,13 +410,8 @@ struct scop /* The context used internally by ISL. */ isl_ctx *isl_context; - /* The original dependence relations: - RAW are read after write dependences, - WAR are write after read dependences, - WAW are write after write dependences. */ - isl_union_map *must_raw, *may_raw, *must_raw_no_source, *may_raw_no_source, - *must_war, *may_war, *must_war_no_source, *may_war_no_source, - *must_waw, *may_waw, *must_waw_no_source, *may_waw_no_source; + /* The data dependence relation among the data references in this scop. */ + isl_union_map *dependence; }; extern scop_p new_scop (edge, edge); -- 2.1.4