public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH 3/5] Remove continue from loop, add one more assert.
  2011-05-24 20:26 [PATCH 0/5] Graphite branch cleanups Sebastian Pop
@ 2011-05-24 20:24 ` Sebastian Pop
  2011-05-24 20:34 ` [PATCH 4/5] Remove memory leaks, " Sebastian Pop
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Pop @ 2011-05-24 20:24 UTC (permalink / raw)
  To: gcc-patches; +Cc: gcc-graphite, Sebastian Pop

2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-dependences.c (build_alias_set_powerset): Remove
	continue from loop, add one more assert.
---
 gcc/ChangeLog.graphite     |    5 +++++
 gcc/graphite-dependences.c |   15 ++++++---------
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index af1c764..afcac69 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,10 @@
 2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-dependences.c (build_alias_set_powerset): Remove
+	continue from loop, add one more assert.
+
+2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-dependences.c (graphite_outer_subscript_bound): Remove
 	unused parameter.
 	* graphite-dependences.h (graphite_outer_subscript_bound): Same.
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 87a8bef..cf68507 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -171,19 +171,16 @@ build_alias_set_powerset (ppl_Pointset_Powerset_C_Polyhedron_t alias_powerset,
 {
   ppl_dimension_type *ds;
   ppl_dimension_type access_dim;
-  unsigned i, pos = 0;
+  unsigned i, pos;
 
   ppl_Pointset_Powerset_C_Polyhedron_space_dimension (alias_powerset,
 						      &access_dim);
-  ds = XNEWVEC (ppl_dimension_type, access_dim-1);
-  for (i = 0; i < access_dim; i++)
-    {
-      if (i == alias_dim)
-	continue;
+  ds = XNEWVEC (ppl_dimension_type, access_dim - 1);
+  gcc_assert (alias_dim < access_dim);
 
-      ds[pos] = i;
-      pos++;
-    }
+  for (pos = 0, i = 0; i < access_dim; i++)
+    if (i != alias_dim)
+      ds[pos++] = i;
 
   ppl_Pointset_Powerset_C_Polyhedron_remove_space_dimensions (alias_powerset,
 							      ds,
-- 
1.7.4.1


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

* [PATCH 0/5] Graphite branch cleanups
@ 2011-05-24 20:26 Sebastian Pop
  2011-05-24 20:24 ` [PATCH 3/5] Remove continue from loop, add one more assert Sebastian Pop
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Sebastian Pop @ 2011-05-24 20:26 UTC (permalink / raw)
  To: gcc-patches; +Cc: gcc-graphite, Sebastian Pop

Hi,
I have committed the following patches to the graphite branch:

  Use zero_dim_array_p instead of graphite_artificial_array_p.
  Remove unused parameter.
  Remove continue from loop, add one more assert.
  Remove memory leaks, add one more assert.
  Fix typo.

 gcc/ChangeLog.graphite           |   30 ++++++++++++++++++++++++++++
 gcc/graphite-dependences.c       |   39 +++++++++++++++++++------------------
 gcc/graphite-dependences.h       |    2 +-
 gcc/graphite-opencl-codegen.c    |    6 ++--
 gcc/graphite-opencl-meta-clast.c |    2 +-
 gcc/graphite-opencl.c            |   40 +------------------------------------
 6 files changed, 57 insertions(+), 62 deletions(-)


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

* [PATCH 4/5] Remove memory leaks, add one more assert.
  2011-05-24 20:26 [PATCH 0/5] Graphite branch cleanups Sebastian Pop
  2011-05-24 20:24 ` [PATCH 3/5] Remove continue from loop, add one more assert Sebastian Pop
@ 2011-05-24 20:34 ` Sebastian Pop
  2011-05-24 20:35 ` [PATCH 1/5] Use zero_dim_array_p instead of graphite_artificial_array_p Sebastian Pop
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Pop @ 2011-05-24 20:34 UTC (permalink / raw)
  To: gcc-patches; +Cc: gcc-graphite, Sebastian Pop

2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-dependences.c (graphite_outer_subscript_bound): Remove
	memory leaks, add one more assert.
---
 gcc/ChangeLog.graphite     |    5 +++++
 gcc/graphite-dependences.c |   21 +++++++++++++--------
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index afcac69..9f71fe8 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,10 @@
 2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-dependences.c (graphite_outer_subscript_bound): Remove
+	memory leaks, add one more assert.
+
+2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-dependences.c (build_alias_set_powerset): Remove
 	continue from loop, add one more assert.
 
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index cf68507..840c004 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -754,7 +754,7 @@ graphite_outer_subscript_bound (poly_dr_p pdr)
   graphite_dim_t gdim = scop_nb_params (scop);
 
   graphite_dim_t dim = tdim + dim1;
-
+  unsigned i, pos, sub1_dim = dim - sdim + 1 - gdim;
   ppl_Pointset_Powerset_C_Polyhedron_t isc, idr, res;
 
   combine_context_id_scat (&isc, pbb, false);
@@ -772,23 +772,28 @@ graphite_outer_subscript_bound (poly_dr_p pdr)
   {
     ppl_Linear_Expression_t le;
     ppl_Coefficient_t coef;
-    mpz_t v;
-    unsigned i;
+    mpz_t one;
 
-    mpz_init (v);
-    mpz_set_si (v, 1);
+    mpz_init (one);
+    mpz_set_si (one, 1);
     ppl_new_Coefficient (&coef);
-    ppl_assign_Coefficient_from_mpz_t (coef, v);
+    ppl_assign_Coefficient_from_mpz_t (coef, one);
 
     ppl_new_Linear_Expression_with_dimension (&le, dim);
 
-    for (i = 0; i < dim - sdim + 1 - gdim; i++)
+    for (i = 0; i < sub1_dim; i++)
       ppl_Pointset_Powerset_C_Polyhedron_affine_image (res, i, le, coef);
+
+    ppl_delete_Linear_Expression (le);
+    ppl_delete_Coefficient (coef);
+    mpz_clear (one);
   }
 
   {
     ppl_dimension_type *ds = XNEWVEC (ppl_dimension_type, dim - gdim - 1);
-    unsigned i, pos, sub1_dim = dim - sdim + 1 - gdim;
+
+    gcc_assert (sub1_dim < dim - gdim);
+
     for (i = 0, pos = 0; i < dim - gdim; i++)
       if (i != sub1_dim)
 	ds[pos++] = i;
-- 
1.7.4.1


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

* [PATCH 5/5] Fix typo.
  2011-05-24 20:26 [PATCH 0/5] Graphite branch cleanups Sebastian Pop
                   ` (2 preceding siblings ...)
  2011-05-24 20:35 ` [PATCH 1/5] Use zero_dim_array_p instead of graphite_artificial_array_p Sebastian Pop
@ 2011-05-24 20:35 ` Sebastian Pop
  2011-05-24 20:36 ` [PATCH 2/5] Remove unused parameter Sebastian Pop
  4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Pop @ 2011-05-24 20:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: gcc-graphite, Sebastian Pop

2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-opencl-codegen.c (opencl_print_local_vars): Fix typo.
---
 gcc/ChangeLog.graphite        |    4 ++++
 gcc/graphite-opencl-codegen.c |    6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 9f71fe8..a4130b9 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,9 @@
 2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* graphite-opencl-codegen.c (opencl_print_local_vars): Fix typo.
+
+2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-dependences.c (graphite_outer_subscript_bound): Remove
 	memory leaks, add one more assert.
 
diff --git a/gcc/graphite-opencl-codegen.c b/gcc/graphite-opencl-codegen.c
index 891fef0..e2eea2e 100644
--- a/gcc/graphite-opencl-codegen.c
+++ b/gcc/graphite-opencl-codegen.c
@@ -682,7 +682,7 @@ opencl_perfect_nested_to_kernel (opencl_main code_gen, struct clast_for *f,
    innermost iterators to append respectively.  */
 
 static void
-opencl_print_local_vars (const char *fist, const char *last,
+opencl_print_local_vars (const char *first, const char *last,
 			 const char *type, opencl_main code_gen)
 {
   char **names = cloog_names_scattering (code_gen->root_names);
@@ -693,7 +693,7 @@ opencl_print_local_vars (const char *fist, const char *last,
     {
       const char *tmp = names[i];
 
-      if (opencl_cmp_scat (fist, tmp) <= 0
+      if (opencl_cmp_scat (first, tmp) <= 0
 	  && opencl_cmp_scat (last, tmp) >= 0)
 	{
 	  const char **slot =
@@ -703,7 +703,7 @@ opencl_print_local_vars (const char *fist, const char *last,
 	  continue;
 	}
 
-      if (opencl_cmp_scat (fist, tmp) > 0)
+      if (opencl_cmp_scat (first, tmp) > 0)
 	continue;
 
       opencl_append_string_to_body (type, code_gen);
-- 
1.7.4.1


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

* [PATCH 1/5] Use zero_dim_array_p instead of graphite_artificial_array_p.
  2011-05-24 20:26 [PATCH 0/5] Graphite branch cleanups Sebastian Pop
  2011-05-24 20:24 ` [PATCH 3/5] Remove continue from loop, add one more assert Sebastian Pop
  2011-05-24 20:34 ` [PATCH 4/5] Remove memory leaks, " Sebastian Pop
@ 2011-05-24 20:35 ` Sebastian Pop
  2011-05-24 20:35 ` [PATCH 5/5] Fix typo Sebastian Pop
  2011-05-24 20:36 ` [PATCH 2/5] Remove unused parameter Sebastian Pop
  4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Pop @ 2011-05-24 20:35 UTC (permalink / raw)
  To: gcc-patches; +Cc: gcc-graphite, Sebastian Pop

2011-05-24  Alexey Kravets  <kayrick@ispras.ru>

	* graphite-opencl.c (opencl_private_var_name_p): Removed.
	(graphite_artificial_array_p): Removed.
	(opencl_data_create): Use zero_dim_array_p instead of
	graphite_artificial_array_p.
---
 gcc/ChangeLog.graphite |    7 +++++++
 gcc/graphite-opencl.c  |   38 +-------------------------------------
 2 files changed, 8 insertions(+), 37 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index b1fa8ca..50948b6 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,10 @@
+2011-05-24  Alexey Kravets  <kayrick@ispras.ru>
+
+	* graphite-opencl.c (opencl_private_var_name_p): Removed.
+	(graphite_artificial_array_p): Removed.
+	(opencl_data_create): Use zero_dim_array_p instead of
+	graphite_artificial_array_p.
+
 2011-01-25  Sebastian Pop  <sebastian.pop@amd.com>
 
 	* graphite-opencl.c (opencl_create_function_call): Use cl_khr_fp64
diff --git a/gcc/graphite-opencl.c b/gcc/graphite-opencl.c
index ea894ee..53704d2 100644
--- a/gcc/graphite-opencl.c
+++ b/gcc/graphite-opencl.c
@@ -330,42 +330,6 @@ zero_dim_array_p (tree var)
   return TREE_INT_CST_LOW (up_bound) == 0;
 }
 
-/* Check whether NAME is the name of the artificial array, which can be
-   privatized.  */
-
-static bool
-opencl_private_var_name_p (const char *name)
-{
-  static const char *general_reduction = "General_Reduction";
-  static const char *close_phi = "Close_Phi";
-  static const char *cross_bb = "Cross_BB_scalar_dependence";
-  static const char *commutative = "Commutative_Associative_Reduction";
-
-  if (!name)
-    return false;
-
-  return
-    ((strstr (name, general_reduction) == name)
-     || (strstr (name, close_phi) == name)
-     || (strstr (name, commutative) == name)
-     || (strstr (name, cross_bb) == name));
-}
-
-/* Check whether VAR is an artificial array, which can be privatized.  */
-
-static bool
-graphite_artificial_array_p (tree var)
-{
-  tree name;
-
-  if (TREE_CODE (var) != VAR_DECL
-      || !zero_dim_array_p (var)
-      || !(name = DECL_NAME (var)))
-    return false;
-
-  return opencl_private_var_name_p (IDENTIFIER_POINTER (name));
-}
-
 /* Get depth of type TYPE scalar (base) part.  */
 
 static int
@@ -393,7 +357,7 @@ opencl_data_create (tree var, tree size)
   opencl_data tmp = XNEW (struct opencl_data_def);
   tree type = TREE_TYPE (var);
 
-  tmp->can_be_private = graphite_artificial_array_p (var);
+  tmp->can_be_private = zero_dim_array_p (var);
   tmp->exact_object = var;
 
   tmp->supported = TREE_CODE (var) == VAR_DECL || TREE_CODE (var) == SSA_NAME;
-- 
1.7.4.1


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

* [PATCH 2/5] Remove unused parameter.
  2011-05-24 20:26 [PATCH 0/5] Graphite branch cleanups Sebastian Pop
                   ` (3 preceding siblings ...)
  2011-05-24 20:35 ` [PATCH 5/5] Fix typo Sebastian Pop
@ 2011-05-24 20:36 ` Sebastian Pop
  4 siblings, 0 replies; 6+ messages in thread
From: Sebastian Pop @ 2011-05-24 20:36 UTC (permalink / raw)
  To: gcc-patches; +Cc: gcc-graphite, Sebastian Pop

2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-dependences.c (graphite_outer_subscript_bound): Remove
	unused parameter.
	* graphite-dependences.h (graphite_outer_subscript_bound): Same.
	* graphite-opencl-meta-clast.c (opencl_set_meta_rw_flags): Update
	call to graphite_outer_subscript_bound.
	* graphite-opencl.c (opencl_get_indirect_size): Same.
---
 gcc/ChangeLog.graphite           |    9 +++++++++
 gcc/graphite-dependences.c       |    3 +--
 gcc/graphite-dependences.h       |    2 +-
 gcc/graphite-opencl-meta-clast.c |    2 +-
 gcc/graphite-opencl.c            |    2 +-
 5 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 50948b6..af1c764 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,12 @@
+2011-05-24  Sebastian Pop  <sebastian.pop@amd.com>
+
+	* graphite-dependences.c (graphite_outer_subscript_bound): Remove
+	unused parameter.
+	* graphite-dependences.h (graphite_outer_subscript_bound): Same.
+	* graphite-opencl-meta-clast.c (opencl_set_meta_rw_flags): Update
+	call to graphite_outer_subscript_bound.
+	* graphite-opencl.c (opencl_get_indirect_size): Same.
+
 2011-05-24  Alexey Kravets  <kayrick@ispras.ru>
 
 	* graphite-opencl.c (opencl_private_var_name_p): Removed.
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 6129905..87a8bef 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -743,8 +743,7 @@ graphite_legal_transform (scop_p scop)
    type is INDIRECT_REF), or NULL if the bound could not be found.  */
 
 tree
-graphite_outer_subscript_bound (poly_dr_p pdr,
-				bool minmax ATTRIBUTE_UNUSED)
+graphite_outer_subscript_bound (poly_dr_p pdr)
 {
   tree bound_tree = NULL_TREE;
   poly_bb_p pbb = PDR_PBB (pdr);
diff --git a/gcc/graphite-dependences.h b/gcc/graphite-dependences.h
index a852411..2aef478 100644
--- a/gcc/graphite-dependences.h
+++ b/gcc/graphite-dependences.h
@@ -60,7 +60,7 @@ extern hashval_t hash_poly_ddr_p (const void *);
 extern void free_poly_ddr (void *);
 extern void dot_deps (scop_p);
 extern void dot_deps_stmt (scop_p);
-extern tree graphite_outer_subscript_bound (poly_dr_p, bool);
+extern tree graphite_outer_subscript_bound (poly_dr_p);
 extern void print_pddr (FILE *, poly_ddr_p);
 extern void debug_pddr (poly_ddr_p);
 
diff --git a/gcc/graphite-opencl-meta-clast.c b/gcc/graphite-opencl-meta-clast.c
index 256ccc2..6e18de4 100644
--- a/gcc/graphite-opencl-meta-clast.c
+++ b/gcc/graphite-opencl-meta-clast.c
@@ -433,7 +433,7 @@ opencl_set_meta_rw_flags (opencl_clast_meta meta,
       if (!data->supported)
         meta->access_unsupported = true;
 
-      if (!graphite_outer_subscript_bound (curr, false))
+      if (!graphite_outer_subscript_bound (curr))
         {
           meta->access_unsupported = true;
 
diff --git a/gcc/graphite-opencl.c b/gcc/graphite-opencl.c
index 53704d2..0d53f66 100644
--- a/gcc/graphite-opencl.c
+++ b/gcc/graphite-opencl.c
@@ -1419,7 +1419,7 @@ opencl_get_indirect_size (tree ptr, poly_dr_p ref)
     case POINTER_TYPE:
       {
 	tree inner_type = TREE_TYPE (ptr);
-	tree t = graphite_outer_subscript_bound (ref, false);
+	tree t = graphite_outer_subscript_bound (ref);
 	tree inner_type_size = TYPE_SIZE_UNIT (inner_type);
 
 	if (inner_type_size == NULL)
-- 
1.7.4.1


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

end of thread, other threads:[~2011-05-24 18:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-24 20:26 [PATCH 0/5] Graphite branch cleanups Sebastian Pop
2011-05-24 20:24 ` [PATCH 3/5] Remove continue from loop, add one more assert Sebastian Pop
2011-05-24 20:34 ` [PATCH 4/5] Remove memory leaks, " Sebastian Pop
2011-05-24 20:35 ` [PATCH 1/5] Use zero_dim_array_p instead of graphite_artificial_array_p Sebastian Pop
2011-05-24 20:35 ` [PATCH 5/5] Fix typo Sebastian Pop
2011-05-24 20:36 ` [PATCH 2/5] Remove unused parameter Sebastian Pop

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