From: Sebastian Pop <s.pop@samsung.com>
To: gcc-patches@gcc.gnu.org
Cc: sebpop@gmail.com, aditya.k7@samsung.com, tobias@grosser.es,
Sebastian Pop <s.pop@samsung.com>
Subject: [PATCH 3/3] move dr->alias_set to a helper structure
Date: Tue, 06 Oct 2015 20:45:00 -0000 [thread overview]
Message-ID: <1444164306-22858-3-git-send-email-s.pop@samsung.com> (raw)
In-Reply-To: <1444164306-22858-1-git-send-email-s.pop@samsung.com>
2015-10-06 Aditya Kumar <aditya.k7@samsung.com>
Sebastian Pop <s.pop@samsung.com>
* graphite-poly.c (new_scop): Initialize drs.
* graphite-poly.h (struct dr_info): New.
(struct scop): Add drs.
* graphite-sese-to-poly.c (pdr_add_alias_set): Use dr_info.
(pdr_add_memory_accesses): Same.
(build_poly_dr): Same.
(build_alias_set): Same.
(build_scop_drs): Same.
(build_pbb_drs): Remove.
* tree-data-ref.c (create_data_ref): Do not initialize alias_set.
* tree-data-ref.h (data_reference): Remove alias_set.
---
gcc/graphite-poly.c | 1 +
gcc/graphite-poly.h | 39 ++++++++++++++++++++++++++++
gcc/graphite-sese-to-poly.c | 63 +++++++++++++++++++--------------------------
gcc/tree-data-ref.c | 1 -
gcc/tree-data-ref.h | 3 ---
5 files changed, 67 insertions(+), 40 deletions(-)
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 52d0765..ab28b7a 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -322,6 +322,7 @@ new_scop (edge entry, edge exit)
scop_set_region (scop, region);
SCOP_BBS (scop).create (3);
POLY_SCOP_P (scop) = false;
+ scop->drs.create (3);
return scop;
}
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 418af6e..37a1755 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -366,6 +366,42 @@ pbb_set_black_box (poly_bb_p pbb, gimple_poly_bb_p black_box)
pbb->black_box = black_box;
}
+/* A helper structure to keep track of data references, polyhedral BBs, and
+ alias sets. */
+
+struct dr_info
+{
+ /* The data reference. */
+ data_reference_p dr;
+
+ /* ALIAS_SET is the SCC number assigned by a graph_dfs of the alias graph. -1
+ is an invalid alias set. */
+ int alias_set;
+
+ /* The polyhedral BB containing this DR. */
+ poly_bb_p pbb;
+
+ /* Construct a DR_INFO from a data reference DR, an ALIAS_SET, and a PBB. */
+ dr_info (data_reference_p dr, int alias_set, poly_bb_p pbb)
+ : dr (dr), alias_set (alias_set), pbb (pbb) {}
+
+ /* A simpler constructor to be able to push these objects in a vec. */
+ dr_info (int i) : dr (NULL), alias_set (-1), pbb (NULL)
+ {
+ gcc_assert (i == 0);
+ }
+
+ /* Assignment operator, to be able to iterate over a vec of these objects. */
+ const dr_info &
+ operator= (const dr_info &p)
+ {
+ dr = p.dr;
+ alias_set = p.alias_set;
+ pbb = p.pbb;
+ return *this;
+ }
+};
+
/* A SCOP is a Static Control Part of the program, simple enough to be
represented in polyhedral form. */
struct scop
@@ -381,6 +417,9 @@ struct scop
representation. */
vec<poly_bb_p> bbs;
+ /* All the data references in this scop. */
+ vec<dr_info> drs;
+
/* The context describes known restrictions concerning the parameters
and relations in between the parameters.
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 40b598d..e61e0bf 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -930,11 +930,11 @@ build_scop_iteration_domain (scop_p scop)
domain. */
static isl_map *
-pdr_add_alias_set (isl_map *acc, data_reference_p dr)
+pdr_add_alias_set (isl_map *acc, dr_info &dri)
{
isl_constraint *c = isl_equality_alloc
(isl_local_space_from_space (isl_map_get_space (acc)));
- c = isl_constraint_set_constant_si (c, -dr->alias_set);
+ c = isl_constraint_set_constant_si (c, -dri.alias_set);
c = isl_constraint_set_coefficient_si (c, isl_dim_out, 0, 1);
return isl_map_add_constraint (acc, c);
@@ -968,8 +968,10 @@ set_index (isl_map *map, int pos, isl_pw_aff *index)
PBB is the poly_bb_p that contains the data reference DR. */
static isl_map *
-pdr_add_memory_accesses (isl_map *acc, data_reference_p dr, poly_bb_p pbb)
+pdr_add_memory_accesses (isl_map *acc, dr_info &dri)
{
+ data_reference_p dr = dri.dr;
+ poly_bb_p pbb = dri.pbb;
int i, nb_subscripts = DR_NUM_DIMENSIONS (dr);
scop_p scop = PBB_SCOP (pbb);
@@ -1056,10 +1058,12 @@ pdr_add_data_dimensions (isl_set *subscript_sizes, scop_p scop,
/* Build data accesses for DR in PBB. */
static void
-build_poly_dr (data_reference_p dr, poly_bb_p pbb)
+build_poly_dr (dr_info &dri)
{
isl_map *acc;
isl_set *subscript_sizes;
+ poly_bb_p pbb = dri.pbb;
+ data_reference_p dr = dri.dr;
scop_p scop = PBB_SCOP (pbb);
{
@@ -1072,19 +1076,18 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
acc = isl_map_set_tuple_id (acc, isl_dim_out, isl_id_for_dr (scop, dr));
}
- acc = pdr_add_alias_set (acc, dr);
- acc = pdr_add_memory_accesses (acc, dr, pbb);
+ acc = pdr_add_alias_set (acc, dri);
+ acc = pdr_add_memory_accesses (acc, dri);
{
isl_id *id = isl_id_for_dr (scop, dr);
int nb = 1 + DR_NUM_DIMENSIONS (dr);
isl_space *space = isl_space_set_alloc (scop->isl_context, 0, nb);
- int alias_set_num = dr->alias_set;
space = isl_space_set_tuple_id (space, isl_dim_set, id);
subscript_sizes = isl_set_nat_universe (space);
subscript_sizes = isl_set_fix_si (subscript_sizes, isl_dim_set, 0,
- alias_set_num);
+ dri.alias_set);
subscript_sizes = pdr_add_data_dimensions (subscript_sizes, scop, dr);
}
@@ -1096,17 +1099,17 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
/* Compute alias-sets for all data references in DRS. */
static void
-build_alias_set (vec<data_reference_p> drs)
+build_alias_set (scop_p scop)
{
- int num_vertices = drs.length ();
+ int num_vertices = scop->drs.length ();
struct graph *g = new_graph (num_vertices);
- data_reference_p dr1, dr2;
+ dr_info dr1 (0), dr2 (0);
int i, j;
int *all_vertices;
- FOR_EACH_VEC_ELT (drs, i, dr1)
- for (j = i+1; drs.iterate (j, &dr2); j++)
- if (dr_may_alias_p (dr1, dr2, true))
+ FOR_EACH_VEC_ELT (scop->drs, i, dr1)
+ for (j = i+1; scop->drs.iterate (j, &dr2); j++)
+ if (dr_may_alias_p (dr1.dr, dr2.dr, true))
{
add_edge (g, i, j);
add_edge (g, j, i);
@@ -1120,30 +1123,17 @@ build_alias_set (vec<data_reference_p> drs)
free (all_vertices);
for (i = 0; i < g->n_vertices; i++)
- drs[i]->alias_set = g->vertices[i].component + 1;
+ scop->drs[i].alias_set = g->vertices[i].component + 1;
free_graph (g);
}
-/* Build the data references for PBB. */
-
-static void
-build_pbb_drs (poly_bb_p pbb)
-{
- int j;
- data_reference_p dr;
- vec<data_reference_p> gbb_drs = GBB_DATA_REFS (PBB_BLACK_BOX (pbb));
-
- FOR_EACH_VEC_ELT (gbb_drs, j, dr)
- build_poly_dr (dr, pbb);
-}
-
/* Build data references in SCOP. */
static void
build_scop_drs (scop_p scop)
{
- int i;
+ int i, j;
poly_bb_p pbb;
/* Remove all the PBBs that do not have data references: these basic
@@ -1157,16 +1147,17 @@ build_scop_drs (scop_p scop)
i--;
}
- auto_vec<data_reference_p, 3> drs;
+ data_reference_p dr;
FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
- drs.safe_splice (GBB_DATA_REFS (PBB_BLACK_BOX (pbb)));
-
- build_alias_set (drs);
+ if (pbb)
+ FOR_EACH_VEC_ELT (GBB_DATA_REFS (PBB_BLACK_BOX (pbb)), j, dr)
+ scop->drs.safe_push (dr_info (dr, -1, pbb));
- FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
- build_pbb_drs (pbb);
+ build_alias_set (scop);
- drs.release ();
+ dr_info dri (0);
+ FOR_EACH_VEC_ELT (scop->drs, i, dri)
+ build_poly_dr (dri);
}
/* Analyze all the data references of STMTS and add them to the
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 0ffa1db..e7087d7 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -1080,7 +1080,6 @@ create_data_ref (loop_p nest, loop_p loop, tree memref, gimple *stmt,
DR_STMT (dr) = stmt;
DR_REF (dr) = memref;
DR_IS_READ (dr) = is_read;
- dr->alias_set = 0;
dr_analyze_innermost (dr, nest);
dr_analyze_indices (dr, nest, loop);
diff --git a/gcc/tree-data-ref.h b/gcc/tree-data-ref.h
index e6f82ff..4c9e357 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -127,9 +127,6 @@ struct data_reference
/* Alias information for the data reference. */
struct dr_alias alias;
-
- /* The alias set for this data reference. */
- int alias_set;
};
#define DR_STMT(DR) (DR)->stmt
--
1.9.1
next prev parent reply other threads:[~2015-10-06 20:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-06 20:45 [PATCH 1/3] remove dead code in computation of alias sets Sebastian Pop
2015-10-06 20:45 ` Sebastian Pop [this message]
2015-10-06 20:45 ` [PATCH 2/3] remove unused struct base_alias_pair Sebastian Pop
2015-10-07 8:11 ` Richard Biener
2015-10-07 13:32 ` Sebastian Pop
2015-10-06 20:47 ` [PATCH 1/3] remove dead code in computation of alias sets Tobias Grosser
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444164306-22858-3-git-send-email-s.pop@samsung.com \
--to=s.pop@samsung.com \
--cc=aditya.k7@samsung.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=sebpop@gmail.com \
--cc=tobias@grosser.es \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).