public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 1/3] remove dead code in computation of alias sets
@ 2015-10-06 20:45 Sebastian Pop
  2015-10-06 20:45 ` [PATCH 3/3] move dr->alias_set to a helper structure Sebastian Pop
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Sebastian Pop @ 2015-10-06 20:45 UTC (permalink / raw)
  To: gcc-patches; +Cc: sebpop, aditya.k7, tobias, Sebastian Pop

2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
                Sebastian Pop  <s.pop@samsung.com>

                * graphite-poly.c (new_poly_dr): Remove dr_base_object_set.
                Do not set PDR_BASE_OBJECT_SET.
                * graphite-poly.h (poly_dr): Same.
                (PDR_BASE_OBJECT_SET): Remove.
                (new_poly_dr): Update decl.
                * graphite-sese-to-poly.c (build_poly_dr): Update call to
                new_poly_dr.
                (write_alias_graph_to_ascii_dimacs): Remove.
                (write_alias_graph_to_ascii_dot): Remove.
                (write_alias_graph_to_ascii_ecc): Remove.
                (dr_same_base_object_p): Remove.
                (build_alias_set_optimal_p): Rename build_alias_set.  Remove dead
                code.
                (build_base_obj_set_for_drs): Remove.
                (dump_alias_graphs): Remove.
                (build_scop_drs): Remove dead code.
---
 gcc/graphite-poly.c         |   5 +-
 gcc/graphite-poly.h         |   7 +-
 gcc/graphite-sese-to-poly.c | 275 +++-----------------------------------------
 3 files changed, 20 insertions(+), 267 deletions(-)

diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 5d6a669..7de0e81 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -136,15 +136,14 @@ apply_poly_transforms (scop_p scop)
    NB_SUBSCRIPTS.  */
 
 void
-new_poly_dr (poly_bb_p pbb, int dr_base_object_set,
-	     enum poly_dr_type type, data_reference_p cdr, graphite_dim_t nb_subscripts,
+new_poly_dr (poly_bb_p pbb, enum poly_dr_type type, data_reference_p cdr,
+	     graphite_dim_t nb_subscripts,
 	     isl_map *acc, isl_set *subscript_sizes)
 {
   static int id = 0;
   poly_dr_p pdr = XNEW (struct poly_dr);
 
   PDR_ID (pdr) = id++;
-  PDR_BASE_OBJECT_SET (pdr) = dr_base_object_set;
   PDR_NB_REFS (pdr) = 1;
   PDR_PBB (pdr) = pbb;
   pdr->accesses = acc;
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 982fa94..3c4353d 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -182,10 +182,6 @@ struct poly_dr
   isl_map *accesses;
   isl_set *subscript_sizes;
 
-  /* Data reference's base object set number, we must assure 2 pdrs are in the
-     same base object set before dependency checking.  */
-  int dr_base_object_set;
-
   /* The number of subscripts.  */
   graphite_dim_t nb_subscripts;
 };
@@ -196,10 +192,9 @@ struct poly_dr
 #define PDR_PBB(PDR) (PDR->pbb)
 #define PDR_TYPE(PDR) (PDR->type)
 #define PDR_ACCESSES(PDR) (NULL)
-#define PDR_BASE_OBJECT_SET(PDR) (PDR->dr_base_object_set)
 #define PDR_NB_SUBSCRIPTS(PDR) (PDR->nb_subscripts)
 
-void new_poly_dr (poly_bb_p, int, enum poly_dr_type, data_reference_p,
+void new_poly_dr (poly_bb_p, enum poly_dr_type, data_reference_p,
 		  graphite_dim_t, isl_map *, isl_set *);
 void free_poly_dr (poly_dr_p);
 void debug_pdr (poly_dr_p, int);
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index d0c7eb4..235c911 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -1065,7 +1065,6 @@ pdr_add_data_dimensions (isl_set *subscript_sizes, scop_p scop,
 static void
 build_poly_dr (data_reference_p dr, poly_bb_p pbb)
 {
-  int dr_base_object_set;
   isl_map *acc;
   isl_set *subscript_sizes;
   scop_p scop = PBB_SCOP (pbb);
@@ -1100,131 +1099,21 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
     subscript_sizes = pdr_add_data_dimensions (subscript_sizes, scop, dr);
   }
 
-  gcc_assert (dr->aux);
-  dr_base_object_set = ((base_alias_pair *)(dr->aux))->base_obj_set;
-
-  new_poly_dr (pbb, dr_base_object_set,
+  new_poly_dr (pbb,
 	       DR_IS_READ (dr) ? PDR_READ : PDR_WRITE,
 	       dr, DR_NUM_DIMENSIONS (dr), acc, subscript_sizes);
 }
 
-/* Write to FILE the alias graph of data references in DIMACS format.  */
-
-static inline bool
-write_alias_graph_to_ascii_dimacs (FILE *file, char *comment,
-				   vec<data_reference_p> drs)
-{
-  int num_vertex = drs.length ();
-  int edge_num = 0;
-  data_reference_p dr1, dr2;
-  int i, j;
-
-  if (num_vertex == 0)
-    return true;
-
-  FOR_EACH_VEC_ELT (drs, i, dr1)
-    for (j = i + 1; drs.iterate (j, &dr2); j++)
-      if (dr_may_alias_p (dr1, dr2, true))
-	edge_num++;
-
-  fprintf (file, "$\n");
-
-  if (comment)
-    fprintf (file, "c %s\n", comment);
-
-  fprintf (file, "p edge %d %d\n", num_vertex, edge_num);
-
-  FOR_EACH_VEC_ELT (drs, i, dr1)
-    for (j = i + 1; drs.iterate (j, &dr2); j++)
-      if (dr_may_alias_p (dr1, dr2, true))
-	fprintf (file, "e %d %d\n", i + 1, j + 1);
+/* Compute alias-sets for all data references in DRS.  */
 
-  return true;
-}
-
-/* Write to FILE the alias graph of data references in DOT format.  */
-
-static inline bool
-write_alias_graph_to_ascii_dot (FILE *file, char *comment,
-				vec<data_reference_p> drs)
-{
-  int num_vertex = drs.length ();
-  data_reference_p dr1, dr2;
-  int i, j;
-
-  if (num_vertex == 0)
-    return true;
-
-  fprintf (file, "$\n");
-
-  if (comment)
-    fprintf (file, "c %s\n", comment);
-
-  /* First print all the vertices.  */
-  FOR_EACH_VEC_ELT (drs, i, dr1)
-    fprintf (file, "n%d;\n", i);
-
-  FOR_EACH_VEC_ELT (drs, i, dr1)
-    for (j = i + 1; drs.iterate (j, &dr2); j++)
-      if (dr_may_alias_p (dr1, dr2, true))
-	fprintf (file, "n%d n%d\n", i, j);
-
-  return true;
-}
-
-/* Write to FILE the alias graph of data references in ECC format.  */
-
-static inline bool
-write_alias_graph_to_ascii_ecc (FILE *file, char *comment,
-				vec<data_reference_p> drs)
-{
-  int num_vertex = drs.length ();
-  data_reference_p dr1, dr2;
-  int i, j;
-
-  if (num_vertex == 0)
-    return true;
-
-  fprintf (file, "$\n");
-
-  if (comment)
-    fprintf (file, "c %s\n", comment);
-
-  FOR_EACH_VEC_ELT (drs, i, dr1)
-    for (j = i + 1; drs.iterate (j, &dr2); j++)
-      if (dr_may_alias_p (dr1, dr2, true))
-	fprintf (file, "%d %d\n", i, j);
-
-  return true;
-}
-
-/* Check if DR1 and DR2 are in the same object set.  */
-
-static bool
-dr_same_base_object_p (const struct data_reference *dr1,
-		       const struct data_reference *dr2)
-{
-  return operand_equal_p (DR_BASE_OBJECT (dr1), DR_BASE_OBJECT (dr2), 0);
-}
-
-/* Uses DFS component number as representative of alias-sets. Also tests for
-   optimality by verifying if every connected component is a clique. Returns
-   true (1) if the above test is true, and false (0) otherwise.  */
-
-static int
-build_alias_set_optimal_p (vec<data_reference_p> drs)
+static void
+build_alias_set (vec<data_reference_p> drs)
 {
   int num_vertices = drs.length ();
   struct graph *g = new_graph (num_vertices);
   data_reference_p dr1, dr2;
   int i, j;
-  int num_connected_components;
-  int v_indx1, v_indx2, num_vertices_in_component;
   int *all_vertices;
-  int *vertices;
-  struct graph_edge *e;
-  int this_component_is_clique;
-  int all_components_are_cliques = 1;
 
   FOR_EACH_VEC_ELT (drs, i, dr1)
     for (j = i+1; drs.iterate (j, &dr2); j++)
@@ -1235,103 +1124,25 @@ build_alias_set_optimal_p (vec<data_reference_p> drs)
 	}
 
   all_vertices = XNEWVEC (int, num_vertices);
-  vertices = XNEWVEC (int, num_vertices);
   for (i = 0; i < num_vertices; i++)
     all_vertices[i] = i;
 
-  num_connected_components = graphds_dfs (g, all_vertices, num_vertices,
-					  NULL, true, NULL);
-  for (i = 0; i < g->n_vertices; i++)
-    {
-      data_reference_p dr = drs[i];
-      base_alias_pair *bap;
-
-      gcc_assert (dr->aux);
-      bap = (base_alias_pair *)(dr->aux);
-
-      bap->alias_set = XNEW (int);
-      *(bap->alias_set) = g->vertices[i].component + 1;
-    }
-
-  /* Verify if the DFS numbering results in optimal solution.  */
-  for (i = 0; i < num_connected_components; i++)
-    {
-      num_vertices_in_component = 0;
-      /* Get all vertices whose DFS component number is the same as i.  */
-      for (j = 0; j < num_vertices; j++)
-	if (g->vertices[j].component == i)
-	  vertices[num_vertices_in_component++] = j;
-
-      /* Now test if the vertices in 'vertices' form a clique, by testing
-	 for edges among each pair.  */
-      this_component_is_clique = 1;
-      for (v_indx1 = 0; v_indx1 < num_vertices_in_component; v_indx1++)
-	{
-	  for (v_indx2 = v_indx1+1; v_indx2 < num_vertices_in_component; v_indx2++)
-	    {
-	      /* Check if the two vertices are connected by iterating
-		 through all the edges which have one of these are source.  */
-	      e = g->vertices[vertices[v_indx2]].pred;
-	      while (e)
-		{
-		  if (e->src == vertices[v_indx1])
-		    break;
-		  e = e->pred_next;
-		}
-	      if (!e)
-		{
-		  this_component_is_clique = 0;
-		  break;
-		}
-	    }
-	  if (!this_component_is_clique)
-	    all_components_are_cliques = 0;
-	}
-    }
-
+  graphds_dfs (g, all_vertices, num_vertices, NULL, true, NULL);
   free (all_vertices);
-  free (vertices);
-  free_graph (g);
-  return all_components_are_cliques;
-}
 
-/* Group each data reference in DRS with its base object set num.  */
-
-static void
-build_base_obj_set_for_drs (vec<data_reference_p> drs)
-{
-  int num_vertex = drs.length ();
-  struct graph *g = new_graph (num_vertex);
-  data_reference_p dr1, dr2;
-  int i, j;
-  int *queue;
-
-  FOR_EACH_VEC_ELT (drs, i, dr1)
-    for (j = i + 1; drs.iterate (j, &dr2); j++)
-      if (dr_same_base_object_p (dr1, dr2))
-	{
-	  add_edge (g, i, j);
-	  add_edge (g, j, i);
-	}
-
-  queue = XNEWVEC (int, num_vertex);
-  for (i = 0; i < num_vertex; i++)
-    queue[i] = i;
-
-  graphds_dfs (g, queue, num_vertex, NULL, true, NULL);
+  data_reference_p dr;
+  FOR_EACH_VEC_ELT (drs, i, dr)
+    dr->aux = XNEW (base_alias_pair);
 
   for (i = 0; i < g->n_vertices; i++)
     {
       data_reference_p dr = drs[i];
-      base_alias_pair *bap;
-
-      gcc_assert (dr->aux);
-      bap = (base_alias_pair *)(dr->aux);
-
-      bap->base_obj_set = g->vertices[i].component + 1;
+      base_alias_pair *bap = (base_alias_pair *)(dr->aux);
+      bap->alias_set = XNEW (int);
+      int c = g->vertices[i].component + 1;
+      *(bap->alias_set) = c;
     }
 
-  free (queue);
   free_graph (g);
 }
 
@@ -1348,48 +1159,12 @@ build_pbb_drs (poly_bb_p pbb)
     build_poly_dr (dr, pbb);
 }
 
-/* Dump to file the alias graphs for the data references in DRS.  */
-
-static void
-dump_alias_graphs (vec<data_reference_p> drs)
-{
-  char comment[100];
-  FILE *file_dimacs, *file_ecc, *file_dot;
-
-  file_dimacs = fopen ("/tmp/dr_alias_graph_dimacs", "ab");
-  if (file_dimacs)
-    {
-      snprintf (comment, sizeof (comment), "%s %s", main_input_filename,
-		current_function_name ());
-      write_alias_graph_to_ascii_dimacs (file_dimacs, comment, drs);
-      fclose (file_dimacs);
-    }
-
-  file_ecc = fopen ("/tmp/dr_alias_graph_ecc", "ab");
-  if (file_ecc)
-    {
-      snprintf (comment, sizeof (comment), "%s %s", main_input_filename,
-		current_function_name ());
-      write_alias_graph_to_ascii_ecc (file_ecc, comment, drs);
-      fclose (file_ecc);
-    }
-
-  file_dot = fopen ("/tmp/dr_alias_graph_dot", "ab");
-  if (file_dot)
-    {
-      snprintf (comment, sizeof (comment), "%s %s", main_input_filename,
-		current_function_name ());
-      write_alias_graph_to_ascii_dot (file_dot, comment, drs);
-      fclose (file_dot);
-    }
-}
-
 /* Build data references in SCOP.  */
 
 static void
 build_scop_drs (scop_p scop)
 {
-  int i, j;
+  int i;
   poly_bb_p pbb;
 
   /* Remove all the PBBs that do not have data references: these basic
@@ -1403,32 +1178,16 @@ build_scop_drs (scop_p scop)
 	i--;
       }
 
-  data_reference_p dr;
   auto_vec<data_reference_p, 3> drs;
   FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
-    for (j = 0; GBB_DATA_REFS (PBB_BLACK_BOX (pbb)).iterate (j, &dr); j++)
-      drs.safe_push (dr);
+    drs.safe_splice (GBB_DATA_REFS (PBB_BLACK_BOX (pbb)));
 
-  FOR_EACH_VEC_ELT (drs, i, dr)
-    dr->aux = XNEW (base_alias_pair);
-
-  if (!build_alias_set_optimal_p (drs))
-    {
-      /* TODO: Add support when building alias set is not optimal.  */
-      ;
-    }
-
-  build_base_obj_set_for_drs (drs);
-
-  /* When debugging, enable the following code.  This cannot be used
-     in production compilers.  */
-  if (0)
-    dump_alias_graphs (drs);
-
-  drs.release ();
+  build_alias_set (drs);
 
   FOR_EACH_VEC_ELT (SCOP_BBS (scop), i, pbb)
     build_pbb_drs (pbb);
+
+  drs.release ();
 }
 
 /* Analyze all the data references of STMTS and add them to the
-- 
1.9.1

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 2/3] remove unused struct base_alias_pair
  2015-10-06 20:45 [PATCH 1/3] remove dead code in computation of alias sets Sebastian Pop
  2015-10-06 20:45 ` [PATCH 3/3] move dr->alias_set to a helper structure Sebastian Pop
@ 2015-10-06 20:45 ` Sebastian Pop
  2015-10-07  8:11   ` Richard Biener
  2015-10-06 20:47 ` [PATCH 1/3] remove dead code in computation of alias sets Tobias Grosser
  2 siblings, 1 reply; 6+ messages in thread
From: Sebastian Pop @ 2015-10-06 20:45 UTC (permalink / raw)
  To: gcc-patches; +Cc: sebpop, aditya.k7, tobias, Sebastian Pop

2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
                Sebastian Pop  <s.pop@samsung.com>

                * graphite-poly.c (free_data_refs_aux): Remove.
                (free_gimple_poly_bb): Do not call free_data_refs_aux.
                * graphite-poly.h (struct base_alias_pair): Remove.
                * graphite-sese-to-poly.c (pdr_add_alias_set): Remove all uses of
                base_alias_pair and dr->aux.
                (build_alias_set): Same.
                * tree-data-ref.c (create_data_ref): Initialize alias_set.
                * tree-data-ref.h (data_reference): Add alias_set.
---
 gcc/graphite-poly.c         | 18 ------------------
 gcc/graphite-poly.h         |  6 ------
 gcc/graphite-sese-to-poly.c | 29 ++++-------------------------
 gcc/tree-data-ref.c         |  1 +
 gcc/tree-data-ref.h         |  3 +++
 5 files changed, 8 insertions(+), 49 deletions(-)

diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 7de0e81..52d0765 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -273,29 +273,11 @@ new_gimple_poly_bb (basic_block bb, vec<data_reference_p> drs)
   return gbb;
 }
 
-static void
-free_data_refs_aux (vec<data_reference_p> datarefs)
-{
-  unsigned int i;
-  data_reference_p dr;
-
-  FOR_EACH_VEC_ELT (datarefs, i, dr)
-    if (dr->aux)
-      {
-	base_alias_pair_p bap = (base_alias_pair_p)(dr->aux);
-
-	free (bap->alias_set);
-
-	free (bap);
-	dr->aux = NULL;
-      }
-}
 /* Frees GBB.  */
 
 void
 free_gimple_poly_bb (gimple_poly_bb_p gbb)
 {
-  free_data_refs_aux (GBB_DATA_REFS (gbb));
   free_data_refs (GBB_DATA_REFS (gbb));
 
   GBB_CONDITIONS (gbb).release ();
diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
index 3c4353d..418af6e 100644
--- a/gcc/graphite-poly.h
+++ b/gcc/graphite-poly.h
@@ -417,12 +417,6 @@ struct scop
 #define SCOP_CONTEXT(S) (NULL)
 #define POLY_SCOP_P(S) (S->poly_scop_p)
 
-typedef struct base_alias_pair
-{
-  int base_obj_set;
-  int *alias_set;
-} *base_alias_pair_p;
-
 extern scop_p new_scop (edge, edge);
 extern void free_scop (scop_p);
 extern gimple_poly_bb_p new_gimple_poly_bb (basic_block, vec<data_reference_p>);
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 235c911..40b598d 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -932,16 +932,9 @@ build_scop_iteration_domain (scop_p scop)
 static isl_map *
 pdr_add_alias_set (isl_map *acc, data_reference_p dr)
 {
-  isl_constraint *c;
-  int alias_set_num = 0;
-  base_alias_pair *bap = (base_alias_pair *)(dr->aux);
-
-  if (bap && bap->alias_set)
-    alias_set_num = *(bap->alias_set);
-
-  c = isl_equality_alloc
+  isl_constraint *c = isl_equality_alloc
       (isl_local_space_from_space (isl_map_get_space (acc)));
-  c = isl_constraint_set_constant_si (c, -alias_set_num);
+  c = isl_constraint_set_constant_si (c, -dr->alias_set);
   c = isl_constraint_set_coefficient_si (c, isl_dim_out, 0, 1);
 
   return isl_map_add_constraint (acc, c);
@@ -1086,11 +1079,7 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
     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 = 0;
-    base_alias_pair *bap = (base_alias_pair *)(dr->aux);
-
-    if (bap && bap->alias_set)
-      alias_set_num = *(bap->alias_set);
+    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);
@@ -1130,18 +1119,8 @@ build_alias_set (vec<data_reference_p> drs)
   graphds_dfs (g, all_vertices, num_vertices, NULL, true, NULL);
   free (all_vertices);
 
-  data_reference_p dr;
-  FOR_EACH_VEC_ELT (drs, i, dr)
-    dr->aux = XNEW (base_alias_pair);
-
   for (i = 0; i < g->n_vertices; i++)
-    {
-      data_reference_p dr = drs[i];
-      base_alias_pair *bap = (base_alias_pair *)(dr->aux);
-      bap->alias_set = XNEW (int);
-      int c = g->vertices[i].component + 1;
-      *(bap->alias_set) = c;
-    }
+    drs[i]->alias_set = g->vertices[i].component + 1;
 
   free_graph (g);
 }
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index e7087d7..0ffa1db 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -1080,6 +1080,7 @@ 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 4c9e357..e6f82ff 100644
--- a/gcc/tree-data-ref.h
+++ b/gcc/tree-data-ref.h
@@ -127,6 +127,9 @@ 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 3/3] move dr->alias_set to a helper structure
  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
  2015-10-06 20:45 ` [PATCH 2/3] remove unused struct base_alias_pair Sebastian Pop
  2015-10-06 20:47 ` [PATCH 1/3] remove dead code in computation of alias sets Tobias Grosser
  2 siblings, 0 replies; 6+ messages in thread
From: Sebastian Pop @ 2015-10-06 20:45 UTC (permalink / raw)
  To: gcc-patches; +Cc: sebpop, aditya.k7, tobias, Sebastian Pop

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 1/3] remove dead code in computation of alias sets
  2015-10-06 20:45 [PATCH 1/3] remove dead code in computation of alias sets Sebastian Pop
  2015-10-06 20:45 ` [PATCH 3/3] move dr->alias_set to a helper structure Sebastian Pop
  2015-10-06 20:45 ` [PATCH 2/3] remove unused struct base_alias_pair Sebastian Pop
@ 2015-10-06 20:47 ` Tobias Grosser
  2 siblings, 0 replies; 6+ messages in thread
From: Tobias Grosser @ 2015-10-06 20:47 UTC (permalink / raw)
  To: Sebastian Pop, gcc-patches; +Cc: sebpop, aditya.k7

On 10/06/2015 10:45 PM, Sebastian Pop wrote:
> 2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
>                  Sebastian Pop  <s.pop@samsung.com>
>
>                  * graphite-poly.c (new_poly_dr): Remove dr_base_object_set.
>                  Do not set PDR_BASE_OBJECT_SET.
>                  * graphite-poly.h (poly_dr): Same.
>                  (PDR_BASE_OBJECT_SET): Remove.
>                  (new_poly_dr): Update decl.
>                  * graphite-sese-to-poly.c (build_poly_dr): Update call to
>                  new_poly_dr.
>                  (write_alias_graph_to_ascii_dimacs): Remove.
>                  (write_alias_graph_to_ascii_dot): Remove.
>                  (write_alias_graph_to_ascii_ecc): Remove.
>                  (dr_same_base_object_p): Remove.
>                  (build_alias_set_optimal_p): Rename build_alias_set.  Remove dead
>                  code.
>                  (build_base_obj_set_for_drs): Remove.
>                  (dump_alias_graphs): Remove.
>                  (build_scop_drs): Remove dead code.

All LGTM.

Tobias

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] remove unused struct base_alias_pair
  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
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Biener @ 2015-10-07  8:11 UTC (permalink / raw)
  To: Sebastian Pop; +Cc: GCC Patches, Sebastian Pop, aditya.k7, Tobias Grosser

On Tue, Oct 6, 2015 at 10:45 PM, Sebastian Pop <s.pop@samsung.com> wrote:
> 2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
>                 Sebastian Pop  <s.pop@samsung.com>
>
>                 * graphite-poly.c (free_data_refs_aux): Remove.
>                 (free_gimple_poly_bb): Do not call free_data_refs_aux.
>                 * graphite-poly.h (struct base_alias_pair): Remove.
>                 * graphite-sese-to-poly.c (pdr_add_alias_set): Remove all uses of
>                 base_alias_pair and dr->aux.
>                 (build_alias_set): Same.
>                 * tree-data-ref.c (create_data_ref): Initialize alias_set.
>                 * tree-data-ref.h (data_reference): Add alias_set.

Err - this doesn't seem to be an "alias set" in the GCC sense as it doesn't use
alias_set_type?  I find that mildly confusing.  Please use dr->aux to
attach pass
specific info rather than enlarging data-ref with this kind of random data.

Thanks,
Richard.

> ---
>  gcc/graphite-poly.c         | 18 ------------------
>  gcc/graphite-poly.h         |  6 ------
>  gcc/graphite-sese-to-poly.c | 29 ++++-------------------------
>  gcc/tree-data-ref.c         |  1 +
>  gcc/tree-data-ref.h         |  3 +++
>  5 files changed, 8 insertions(+), 49 deletions(-)
>
> diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
> index 7de0e81..52d0765 100644
> --- a/gcc/graphite-poly.c
> +++ b/gcc/graphite-poly.c
> @@ -273,29 +273,11 @@ new_gimple_poly_bb (basic_block bb, vec<data_reference_p> drs)
>    return gbb;
>  }
>
> -static void
> -free_data_refs_aux (vec<data_reference_p> datarefs)
> -{
> -  unsigned int i;
> -  data_reference_p dr;
> -
> -  FOR_EACH_VEC_ELT (datarefs, i, dr)
> -    if (dr->aux)
> -      {
> -       base_alias_pair_p bap = (base_alias_pair_p)(dr->aux);
> -
> -       free (bap->alias_set);
> -
> -       free (bap);
> -       dr->aux = NULL;
> -      }
> -}
>  /* Frees GBB.  */
>
>  void
>  free_gimple_poly_bb (gimple_poly_bb_p gbb)
>  {
> -  free_data_refs_aux (GBB_DATA_REFS (gbb));
>    free_data_refs (GBB_DATA_REFS (gbb));
>
>    GBB_CONDITIONS (gbb).release ();
> diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
> index 3c4353d..418af6e 100644
> --- a/gcc/graphite-poly.h
> +++ b/gcc/graphite-poly.h
> @@ -417,12 +417,6 @@ struct scop
>  #define SCOP_CONTEXT(S) (NULL)
>  #define POLY_SCOP_P(S) (S->poly_scop_p)
>
> -typedef struct base_alias_pair
> -{
> -  int base_obj_set;
> -  int *alias_set;
> -} *base_alias_pair_p;
> -
>  extern scop_p new_scop (edge, edge);
>  extern void free_scop (scop_p);
>  extern gimple_poly_bb_p new_gimple_poly_bb (basic_block, vec<data_reference_p>);
> diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
> index 235c911..40b598d 100644
> --- a/gcc/graphite-sese-to-poly.c
> +++ b/gcc/graphite-sese-to-poly.c
> @@ -932,16 +932,9 @@ build_scop_iteration_domain (scop_p scop)
>  static isl_map *
>  pdr_add_alias_set (isl_map *acc, data_reference_p dr)
>  {
> -  isl_constraint *c;
> -  int alias_set_num = 0;
> -  base_alias_pair *bap = (base_alias_pair *)(dr->aux);
> -
> -  if (bap && bap->alias_set)
> -    alias_set_num = *(bap->alias_set);
> -
> -  c = isl_equality_alloc
> +  isl_constraint *c = isl_equality_alloc
>        (isl_local_space_from_space (isl_map_get_space (acc)));
> -  c = isl_constraint_set_constant_si (c, -alias_set_num);
> +  c = isl_constraint_set_constant_si (c, -dr->alias_set);
>    c = isl_constraint_set_coefficient_si (c, isl_dim_out, 0, 1);
>
>    return isl_map_add_constraint (acc, c);
> @@ -1086,11 +1079,7 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
>      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 = 0;
> -    base_alias_pair *bap = (base_alias_pair *)(dr->aux);
> -
> -    if (bap && bap->alias_set)
> -      alias_set_num = *(bap->alias_set);
> +    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);
> @@ -1130,18 +1119,8 @@ build_alias_set (vec<data_reference_p> drs)
>    graphds_dfs (g, all_vertices, num_vertices, NULL, true, NULL);
>    free (all_vertices);
>
> -  data_reference_p dr;
> -  FOR_EACH_VEC_ELT (drs, i, dr)
> -    dr->aux = XNEW (base_alias_pair);
> -
>    for (i = 0; i < g->n_vertices; i++)
> -    {
> -      data_reference_p dr = drs[i];
> -      base_alias_pair *bap = (base_alias_pair *)(dr->aux);
> -      bap->alias_set = XNEW (int);
> -      int c = g->vertices[i].component + 1;
> -      *(bap->alias_set) = c;
> -    }
> +    drs[i]->alias_set = g->vertices[i].component + 1;
>
>    free_graph (g);
>  }
> diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
> index e7087d7..0ffa1db 100644
> --- a/gcc/tree-data-ref.c
> +++ b/gcc/tree-data-ref.c
> @@ -1080,6 +1080,7 @@ 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 4c9e357..e6f82ff 100644
> --- a/gcc/tree-data-ref.h
> +++ b/gcc/tree-data-ref.h
> @@ -127,6 +127,9 @@ 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
>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 2/3] remove unused struct base_alias_pair
  2015-10-07  8:11   ` Richard Biener
@ 2015-10-07 13:32     ` Sebastian Pop
  0 siblings, 0 replies; 6+ messages in thread
From: Sebastian Pop @ 2015-10-07 13:32 UTC (permalink / raw)
  To: Richard Biener; +Cc: Sebastian Pop, GCC Patches, Aditya Kumar, Tobias Grosser

On Wed, Oct 7, 2015 at 3:11 AM, Richard Biener
<richard.guenther@gmail.com> wrote:
> On Tue, Oct 6, 2015 at 10:45 PM, Sebastian Pop <s.pop@samsung.com> wrote:
>> 2015-10-06  Aditya Kumar  <aditya.k7@samsung.com>
>>                 Sebastian Pop  <s.pop@samsung.com>
>>
>>                 * graphite-poly.c (free_data_refs_aux): Remove.
>>                 (free_gimple_poly_bb): Do not call free_data_refs_aux.
>>                 * graphite-poly.h (struct base_alias_pair): Remove.
>>                 * graphite-sese-to-poly.c (pdr_add_alias_set): Remove all uses of
>>                 base_alias_pair and dr->aux.
>>                 (build_alias_set): Same.
>>                 * tree-data-ref.c (create_data_ref): Initialize alias_set.
>>                 * tree-data-ref.h (data_reference): Add alias_set.
>
> Err - this doesn't seem to be an "alias set" in the GCC sense as it doesn't use
> alias_set_type?  I find that mildly confusing.  Please use dr->aux to
> attach pass
> specific info rather than enlarging data-ref with this kind of random data.

This was a transient state: we remove this field in the next patch. We
were thinking to squash the two patches to avoid the distraction of
adding this field, and in the end we opted to keep the patches
separate.

Sebastian

>
> Thanks,
> Richard.
>
>> ---
>>  gcc/graphite-poly.c         | 18 ------------------
>>  gcc/graphite-poly.h         |  6 ------
>>  gcc/graphite-sese-to-poly.c | 29 ++++-------------------------
>>  gcc/tree-data-ref.c         |  1 +
>>  gcc/tree-data-ref.h         |  3 +++
>>  5 files changed, 8 insertions(+), 49 deletions(-)
>>
>> diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
>> index 7de0e81..52d0765 100644
>> --- a/gcc/graphite-poly.c
>> +++ b/gcc/graphite-poly.c
>> @@ -273,29 +273,11 @@ new_gimple_poly_bb (basic_block bb, vec<data_reference_p> drs)
>>    return gbb;
>>  }
>>
>> -static void
>> -free_data_refs_aux (vec<data_reference_p> datarefs)
>> -{
>> -  unsigned int i;
>> -  data_reference_p dr;
>> -
>> -  FOR_EACH_VEC_ELT (datarefs, i, dr)
>> -    if (dr->aux)
>> -      {
>> -       base_alias_pair_p bap = (base_alias_pair_p)(dr->aux);
>> -
>> -       free (bap->alias_set);
>> -
>> -       free (bap);
>> -       dr->aux = NULL;
>> -      }
>> -}
>>  /* Frees GBB.  */
>>
>>  void
>>  free_gimple_poly_bb (gimple_poly_bb_p gbb)
>>  {
>> -  free_data_refs_aux (GBB_DATA_REFS (gbb));
>>    free_data_refs (GBB_DATA_REFS (gbb));
>>
>>    GBB_CONDITIONS (gbb).release ();
>> diff --git a/gcc/graphite-poly.h b/gcc/graphite-poly.h
>> index 3c4353d..418af6e 100644
>> --- a/gcc/graphite-poly.h
>> +++ b/gcc/graphite-poly.h
>> @@ -417,12 +417,6 @@ struct scop
>>  #define SCOP_CONTEXT(S) (NULL)
>>  #define POLY_SCOP_P(S) (S->poly_scop_p)
>>
>> -typedef struct base_alias_pair
>> -{
>> -  int base_obj_set;
>> -  int *alias_set;
>> -} *base_alias_pair_p;
>> -
>>  extern scop_p new_scop (edge, edge);
>>  extern void free_scop (scop_p);
>>  extern gimple_poly_bb_p new_gimple_poly_bb (basic_block, vec<data_reference_p>);
>> diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
>> index 235c911..40b598d 100644
>> --- a/gcc/graphite-sese-to-poly.c
>> +++ b/gcc/graphite-sese-to-poly.c
>> @@ -932,16 +932,9 @@ build_scop_iteration_domain (scop_p scop)
>>  static isl_map *
>>  pdr_add_alias_set (isl_map *acc, data_reference_p dr)
>>  {
>> -  isl_constraint *c;
>> -  int alias_set_num = 0;
>> -  base_alias_pair *bap = (base_alias_pair *)(dr->aux);
>> -
>> -  if (bap && bap->alias_set)
>> -    alias_set_num = *(bap->alias_set);
>> -
>> -  c = isl_equality_alloc
>> +  isl_constraint *c = isl_equality_alloc
>>        (isl_local_space_from_space (isl_map_get_space (acc)));
>> -  c = isl_constraint_set_constant_si (c, -alias_set_num);
>> +  c = isl_constraint_set_constant_si (c, -dr->alias_set);
>>    c = isl_constraint_set_coefficient_si (c, isl_dim_out, 0, 1);
>>
>>    return isl_map_add_constraint (acc, c);
>> @@ -1086,11 +1079,7 @@ build_poly_dr (data_reference_p dr, poly_bb_p pbb)
>>      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 = 0;
>> -    base_alias_pair *bap = (base_alias_pair *)(dr->aux);
>> -
>> -    if (bap && bap->alias_set)
>> -      alias_set_num = *(bap->alias_set);
>> +    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);
>> @@ -1130,18 +1119,8 @@ build_alias_set (vec<data_reference_p> drs)
>>    graphds_dfs (g, all_vertices, num_vertices, NULL, true, NULL);
>>    free (all_vertices);
>>
>> -  data_reference_p dr;
>> -  FOR_EACH_VEC_ELT (drs, i, dr)
>> -    dr->aux = XNEW (base_alias_pair);
>> -
>>    for (i = 0; i < g->n_vertices; i++)
>> -    {
>> -      data_reference_p dr = drs[i];
>> -      base_alias_pair *bap = (base_alias_pair *)(dr->aux);
>> -      bap->alias_set = XNEW (int);
>> -      int c = g->vertices[i].component + 1;
>> -      *(bap->alias_set) = c;
>> -    }
>> +    drs[i]->alias_set = g->vertices[i].component + 1;
>>
>>    free_graph (g);
>>  }
>> diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
>> index e7087d7..0ffa1db 100644
>> --- a/gcc/tree-data-ref.c
>> +++ b/gcc/tree-data-ref.c
>> @@ -1080,6 +1080,7 @@ 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 4c9e357..e6f82ff 100644
>> --- a/gcc/tree-data-ref.h
>> +++ b/gcc/tree-data-ref.h
>> @@ -127,6 +127,9 @@ 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
>>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-10-07 13:32 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-06 20:45 [PATCH 1/3] remove dead code in computation of alias sets Sebastian Pop
2015-10-06 20:45 ` [PATCH 3/3] move dr->alias_set to a helper structure Sebastian Pop
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

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).