From 0f7a02a32f887d944a760004927518d903bb4443 Mon Sep 17 00:00:00 2001 From: Aditya Kumar Date: Wed, 16 Dec 2015 17:33:07 +0000 Subject: [PATCH] Remove individial dependence pointers and add a scop::dependence to contain all the dependence. 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 * 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. From-SVN: r231708 --- gcc/ChangeLog | 11 ++++++++ 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 ++----- 6 files changed, 66 insertions(+), 72 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2ee6de9..08641b7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,4 +1,15 @@ 2015-12-16 Aditya Kumar + + * 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. + +2015-12-16 Aditya Kumar Sebastian Pop * config.in: Regenerate. diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c index 7b7912a..407a11e 100644 --- a/gcc/graphite-dependences.c +++ b/gcc/graphite-dependences.c @@ -399,28 +399,32 @@ compute_deps (scop_p scop, vec 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) { @@ -429,6 +433,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 2f04de5..b392766 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -3197,18 +3197,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 a8955f9..f5cb5c4 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); isl_options_set_schedule_max_constant_term (scop->isl_context, CONSTANT_BOUND); diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c index 44f0241..00d674c 100644 --- a/gcc/graphite-poly.c +++ b/gcc/graphite-poly.c @@ -295,26 +295,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. */ @@ -335,18 +324,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 099e410..ba91dfa 100644 --- a/gcc/graphite.h +++ b/gcc/graphite.h @@ -411,13 +411,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.7.4