* [PATCH 5/7] Protect loops that might be executed zero times.
2009-11-30 22:11 [PATCH 0/7] Fix SPEC2006 dealII with graphite enabled - committed Tobias Grosser
@ 2009-11-30 22:11 ` Tobias Grosser
2009-12-01 10:16 ` Richard Guenther
2009-11-30 22:11 ` [PATCH 7/7] Correct testcase Tobias Grosser
` (5 subsequent siblings)
6 siblings, 1 reply; 10+ messages in thread
From: Tobias Grosser @ 2009-11-30 22:11 UTC (permalink / raw)
To: gcc-patches
From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>
2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
PR middle-end/42130
* graphite-clast-to-gimple.c (graphite_create_new_loop_guard,
translate_clast_for_loop): New.
(translate_clast_for): Add a condition around the loop, to do not
execute loops with zero iterations.
* testsuite/g++.dg/graphite/pr42130.C: New.
* testsuite/gcc.dg/graphite/pr35356-2.c: Adapt.
---
gcc/ChangeLog.graphite | 10 ++++
gcc/graphite-clast-to-gimple.c | 84 ++++++++++++++++++++++++++++-
gcc/testsuite/g++.dg/graphite/pr42130.C | 18 ++++++
gcc/testsuite/gcc.dg/graphite/pr35356-2.c | 16 +++++-
4 files changed, 124 insertions(+), 4 deletions(-)
create mode 100644 gcc/testsuite/g++.dg/graphite/pr42130.C
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index c705cbd..863b0be 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,15 @@
2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
+ PR middle-end/42130
+ * graphite-clast-to-gimple.c (graphite_create_new_loop_guard,
+ translate_clast_for_loop): New.
+ (translate_clast_for): Add a condition around the loop, to do not
+ execute loops with zero iterations.
+ * testsuite/g++.dg/graphite/pr42130.C: New.
+ * testsuite/gcc.dg/graphite/pr35356-2.c: Adapt.
+
+2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
+
* graphite-clast-to-gimple.c (try_mark_loop_parallel): New.
(translate_clast_for, translate_clast_guard, translate_clast, gloog):
Remove context_loop and level.
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 4f45708..3795f6f 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -768,8 +768,47 @@ try_mark_loop_parallel (sese region, loop_p loop, htab_t bb_pbb_mapping)
loop->can_be_parallel = true;
}
+static tree gcc_type_for_iv_of_clast_loop (struct clast_for *);
-/* Translates a clast for statement STMT to gimple.
+
+/* Creates a new if region protecting the loop to be executed, if the execution
+ * count is zero (lb > ub). */
+static edge
+graphite_create_new_loop_guard (sese region, edge entry_edge,
+ struct clast_for *stmt,
+ VEC (tree, heap) *newivs,
+ htab_t newivs_index, htab_t params_index)
+{
+ tree cond_expr;
+ edge exit_edge;
+ tree type = gcc_type_for_iv_of_clast_loop (stmt);
+ tree lb = clast_to_gcc_expression (type, stmt->LB, region, newivs,
+ newivs_index, params_index);
+ tree ub = clast_to_gcc_expression (type, stmt->UB, region, newivs,
+ newivs_index, params_index);
+
+ /* XXX: Adding +1 and using LT_EXPR helps with loop latches that have a
+ * loop iteration count of "PARAMETER - 1". For PARAMETER == 0 this becomes
+ * 2^{32|64}, and the condition lb <= ub is true, even if we do not want this.
+ * However lb < ub + 1 is false, as expected.
+ * There might be a problem with cases where ub is 2^32. */
+ tree one;
+ Value gmp_one;
+ value_init (gmp_one);
+ value_set_si (gmp_one, 1);
+ one = gmp_cst_to_tree (type, gmp_one);
+ value_clear (gmp_one);
+
+ ub = fold_build2 (PLUS_EXPR, type, ub, one);
+ cond_expr = fold_build2 (LT_EXPR, boolean_type_node, lb, ub);
+
+ exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr);
+
+ return exit_edge;
+}
+
+
+/* Create the loop for a clast for statement.
- REGION is the sese region we used to generate the scop.
- NEXT_E is the edge where new generated code should be attached.
@@ -779,7 +818,7 @@ try_mark_loop_parallel (sese region, loop_p loop, htab_t bb_pbb_mapping)
- PARAMS_INDEX connects the cloog parameters with the gimple parameters in
the sese region. */
static edge
-translate_clast_for (sese region, struct clast_for *stmt, edge next_e,
+translate_clast_for_loop (sese region, struct clast_for *stmt, edge next_e,
htab_t rename_map, VEC (tree, heap) **newivs,
htab_t newivs_index, htab_t bb_pbb_mapping,
htab_t params_index)
@@ -802,6 +841,47 @@ translate_clast_for (sese region, struct clast_for *stmt, edge next_e,
return last_e;
}
+/* Translates a clast for statement STMT to gimple. First a guard is created
+ * protecting the loop, if it is executed zero times. In this guard we create
+ * the real loop structure.
+
+ - REGION is the sese region we used to generate the scop.
+ - NEXT_E is the edge where new generated code should be attached.
+ - RENAME_MAP contains a set of tuples of new names associated to
+ the original variables names.
+ - BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping.
+ - PARAMS_INDEX connects the cloog parameters with the gimple parameters in
+ the sese region. */
+static edge
+translate_clast_for (sese region, struct clast_for *stmt, edge next_e,
+ htab_t rename_map, VEC (tree, heap) **newivs,
+ htab_t newivs_index, htab_t bb_pbb_mapping,
+ htab_t params_index)
+{
+ edge last_e = graphite_create_new_loop_guard (region, next_e, stmt, *newivs,
+ newivs_index, params_index);
+
+ edge true_e = get_true_edge_from_guard_bb (next_e->dest);
+ edge false_e = get_false_edge_from_guard_bb (next_e->dest);
+ edge exit_true_e = single_succ_edge (true_e->dest);
+ edge exit_false_e = single_succ_edge (false_e->dest);
+
+ htab_t before_guard = htab_create (10, rename_map_elt_info,
+ eq_rename_map_elts, free);
+ htab_traverse (rename_map, copy_renames, before_guard);
+
+ next_e = translate_clast_for_loop (region, stmt, true_e, rename_map, newivs,
+ newivs_index, bb_pbb_mapping,
+ params_index);
+
+ insert_guard_phis (last_e->src, exit_true_e, exit_false_e,
+ before_guard, rename_map);
+
+ htab_delete (before_guard);
+
+ return last_e;
+}
+
/* Translates a clast guard statement STMT to gimple.
- REGION is the sese region we used to generate the scop.
diff --git a/gcc/testsuite/g++.dg/graphite/pr42130.C b/gcc/testsuite/g++.dg/graphite/pr42130.C
new file mode 100644
index 0000000..92d3bd8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/graphite/pr42130.C
@@ -0,0 +1,18 @@
+/* { dg-options "-O2 -fno-tree-ch" } */
+#include <vector>
+
+using std::vector;
+
+vector<unsigned> & __attribute__((noinline)) foo(unsigned n, unsigned k)
+{
+ vector<unsigned> *vv = new vector<unsigned>(n, 0u);
+ return *vv;
+}
+
+
+int main()
+{
+ foo(0, 1);
+}
+/* { dg-do run } */
+
diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-2.c b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
index 5432dee..e5b0213 100644
--- a/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
+++ b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
@@ -25,8 +25,20 @@ foo (int bar, int n, int k)
| for (i = max(k+1,0); i < n; i++)
| a[i] = i;
+ XXX: At the moment we generate to protect loops that are executed zero times.
+
+ | if (0 < min (n, k) + 1)
+ | for (i = 0; i < min (n, k); i++)
+ | a[i] = i;
+ | if (k >= 0 && k < n)
+ | a[k] = 1;
+ | if (0 < max(n, k) + 1)
+ | for (i = max(k+1,0); i < n; i++)
+ | a[i] = i;
+
*/
-/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "graphite" } } */
-/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "graphite" } } */
+
+/* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "graphite" } } */
+/* { dg-final { scan-tree-dump-times "MAX_EXPR" 2 "graphite" } } */
/* { dg-final { cleanup-tree-dump "graphite" } } */
--
1.6.5.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 5/7] Protect loops that might be executed zero times.
2009-11-30 22:11 ` [PATCH 5/7] Protect loops that might be executed zero times Tobias Grosser
@ 2009-12-01 10:16 ` Richard Guenther
2009-12-01 10:19 ` Tobias Grosser
0 siblings, 1 reply; 10+ messages in thread
From: Richard Guenther @ 2009-12-01 10:16 UTC (permalink / raw)
To: Tobias Grosser; +Cc: gcc-patches
On Mon, Nov 30, 2009 at 11:10 PM, Tobias Grosser
<grosser@fim.uni-passau.de> wrote:
> From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>
>
> 2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
>
> PR middle-end/42130
> * graphite-clast-to-gimple.c (graphite_create_new_loop_guard,
> translate_clast_for_loop): New.
> (translate_clast_for): Add a condition around the loop, to do not
> execute loops with zero iterations.
> * testsuite/g++.dg/graphite/pr42130.C: New.
> * testsuite/gcc.dg/graphite/pr35356-2.c: Adapt.
> ---
> gcc/ChangeLog.graphite | 10 ++++
> gcc/graphite-clast-to-gimple.c | 84 ++++++++++++++++++++++++++++-
> gcc/testsuite/g++.dg/graphite/pr42130.C | 18 ++++++
> gcc/testsuite/gcc.dg/graphite/pr35356-2.c | 16 +++++-
> 4 files changed, 124 insertions(+), 4 deletions(-)
> create mode 100644 gcc/testsuite/g++.dg/graphite/pr42130.C
>
> diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
> index c705cbd..863b0be 100644
> --- a/gcc/ChangeLog.graphite
> +++ b/gcc/ChangeLog.graphite
> @@ -1,5 +1,15 @@
> 2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
>
> + PR middle-end/42130
> + * graphite-clast-to-gimple.c (graphite_create_new_loop_guard,
> + translate_clast_for_loop): New.
> + (translate_clast_for): Add a condition around the loop, to do not
> + execute loops with zero iterations.
> + * testsuite/g++.dg/graphite/pr42130.C: New.
> + * testsuite/gcc.dg/graphite/pr35356-2.c: Adapt.
> +
> +2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
> +
> * graphite-clast-to-gimple.c (try_mark_loop_parallel): New.
> (translate_clast_for, translate_clast_guard, translate_clast, gloog):
> Remove context_loop and level.
> diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
> index 4f45708..3795f6f 100644
> --- a/gcc/graphite-clast-to-gimple.c
> +++ b/gcc/graphite-clast-to-gimple.c
> @@ -768,8 +768,47 @@ try_mark_loop_parallel (sese region, loop_p loop, htab_t bb_pbb_mapping)
> loop->can_be_parallel = true;
> }
>
> +static tree gcc_type_for_iv_of_clast_loop (struct clast_for *);
>
> -/* Translates a clast for statement STMT to gimple.
> +
> +/* Creates a new if region protecting the loop to be executed, if the execution
> + * count is zero (lb > ub). */
GCC coding-style does not want the leading '*' on the second line
of the comment.
Also seen below again.
Richard.
> +static edge
> +graphite_create_new_loop_guard (sese region, edge entry_edge,
> + struct clast_for *stmt,
> + VEC (tree, heap) *newivs,
> + htab_t newivs_index, htab_t params_index)
> +{
> + tree cond_expr;
> + edge exit_edge;
> + tree type = gcc_type_for_iv_of_clast_loop (stmt);
> + tree lb = clast_to_gcc_expression (type, stmt->LB, region, newivs,
> + newivs_index, params_index);
> + tree ub = clast_to_gcc_expression (type, stmt->UB, region, newivs,
> + newivs_index, params_index);
> +
> + /* XXX: Adding +1 and using LT_EXPR helps with loop latches that have a
> + * loop iteration count of "PARAMETER - 1". For PARAMETER == 0 this becomes
> + * 2^{32|64}, and the condition lb <= ub is true, even if we do not want this.
> + * However lb < ub + 1 is false, as expected.
> + * There might be a problem with cases where ub is 2^32. */
> + tree one;
> + Value gmp_one;
> + value_init (gmp_one);
> + value_set_si (gmp_one, 1);
> + one = gmp_cst_to_tree (type, gmp_one);
> + value_clear (gmp_one);
> +
> + ub = fold_build2 (PLUS_EXPR, type, ub, one);
> + cond_expr = fold_build2 (LT_EXPR, boolean_type_node, lb, ub);
> +
> + exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr);
> +
> + return exit_edge;
> +}
> +
> +
> +/* Create the loop for a clast for statement.
>
> - REGION is the sese region we used to generate the scop.
> - NEXT_E is the edge where new generated code should be attached.
> @@ -779,7 +818,7 @@ try_mark_loop_parallel (sese region, loop_p loop, htab_t bb_pbb_mapping)
> - PARAMS_INDEX connects the cloog parameters with the gimple parameters in
> the sese region. */
> static edge
> -translate_clast_for (sese region, struct clast_for *stmt, edge next_e,
> +translate_clast_for_loop (sese region, struct clast_for *stmt, edge next_e,
> htab_t rename_map, VEC (tree, heap) **newivs,
> htab_t newivs_index, htab_t bb_pbb_mapping,
> htab_t params_index)
> @@ -802,6 +841,47 @@ translate_clast_for (sese region, struct clast_for *stmt, edge next_e,
> return last_e;
> }
>
> +/* Translates a clast for statement STMT to gimple. First a guard is created
> + * protecting the loop, if it is executed zero times. In this guard we create
> + * the real loop structure.
> +
> + - REGION is the sese region we used to generate the scop.
> + - NEXT_E is the edge where new generated code should be attached.
> + - RENAME_MAP contains a set of tuples of new names associated to
> + the original variables names.
> + - BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping.
> + - PARAMS_INDEX connects the cloog parameters with the gimple parameters in
> + the sese region. */
> +static edge
> +translate_clast_for (sese region, struct clast_for *stmt, edge next_e,
> + htab_t rename_map, VEC (tree, heap) **newivs,
> + htab_t newivs_index, htab_t bb_pbb_mapping,
> + htab_t params_index)
> +{
> + edge last_e = graphite_create_new_loop_guard (region, next_e, stmt, *newivs,
> + newivs_index, params_index);
> +
> + edge true_e = get_true_edge_from_guard_bb (next_e->dest);
> + edge false_e = get_false_edge_from_guard_bb (next_e->dest);
> + edge exit_true_e = single_succ_edge (true_e->dest);
> + edge exit_false_e = single_succ_edge (false_e->dest);
> +
> + htab_t before_guard = htab_create (10, rename_map_elt_info,
> + eq_rename_map_elts, free);
> + htab_traverse (rename_map, copy_renames, before_guard);
> +
> + next_e = translate_clast_for_loop (region, stmt, true_e, rename_map, newivs,
> + newivs_index, bb_pbb_mapping,
> + params_index);
> +
> + insert_guard_phis (last_e->src, exit_true_e, exit_false_e,
> + before_guard, rename_map);
> +
> + htab_delete (before_guard);
> +
> + return last_e;
> +}
> +
> /* Translates a clast guard statement STMT to gimple.
>
> - REGION is the sese region we used to generate the scop.
> diff --git a/gcc/testsuite/g++.dg/graphite/pr42130.C b/gcc/testsuite/g++.dg/graphite/pr42130.C
> new file mode 100644
> index 0000000..92d3bd8
> --- /dev/null
> +++ b/gcc/testsuite/g++.dg/graphite/pr42130.C
> @@ -0,0 +1,18 @@
> +/* { dg-options "-O2 -fno-tree-ch" } */
> +#include <vector>
> +
> +using std::vector;
> +
> +vector<unsigned> & __attribute__((noinline)) foo(unsigned n, unsigned k)
> +{
> + vector<unsigned> *vv = new vector<unsigned>(n, 0u);
> + return *vv;
> +}
> +
> +
> +int main()
> +{
> + foo(0, 1);
> +}
> +/* { dg-do run } */
> +
> diff --git a/gcc/testsuite/gcc.dg/graphite/pr35356-2.c b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
> index 5432dee..e5b0213 100644
> --- a/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
> +++ b/gcc/testsuite/gcc.dg/graphite/pr35356-2.c
> @@ -25,8 +25,20 @@ foo (int bar, int n, int k)
> | for (i = max(k+1,0); i < n; i++)
> | a[i] = i;
>
> + XXX: At the moment we generate to protect loops that are executed zero times.
> +
> + | if (0 < min (n, k) + 1)
> + | for (i = 0; i < min (n, k); i++)
> + | a[i] = i;
> + | if (k >= 0 && k < n)
> + | a[k] = 1;
> + | if (0 < max(n, k) + 1)
> + | for (i = max(k+1,0); i < n; i++)
> + | a[i] = i;
> +
> */
>
> -/* { dg-final { scan-tree-dump-times "MIN_EXPR" 1 "graphite" } } */
> -/* { dg-final { scan-tree-dump-times "MAX_EXPR" 1 "graphite" } } */
> +
> +/* { dg-final { scan-tree-dump-times "MIN_EXPR" 2 "graphite" } } */
> +/* { dg-final { scan-tree-dump-times "MAX_EXPR" 2 "graphite" } } */
> /* { dg-final { cleanup-tree-dump "graphite" } } */
> --
> 1.6.5.3
>
>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH 5/7] Protect loops that might be executed zero times.
2009-12-01 10:16 ` Richard Guenther
@ 2009-12-01 10:19 ` Tobias Grosser
0 siblings, 0 replies; 10+ messages in thread
From: Tobias Grosser @ 2009-12-01 10:19 UTC (permalink / raw)
To: Richard Guenther; +Cc: gcc-patches
A. On Tue, 2009-12-01 at 11:05 +0100, Richard Guenther wrote:
> On Mon, Nov 30, 2009 at 11:10 PM, Tobias Grosser
> <grosser@fim.uni-passau.de> wrote:
> > From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>
> >
> > 2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
> >
> > PR middle-end/42130
> > * graphite-clast-to-gimple.c (graphite_create_new_loop_guard,
> > translate_clast_for_loop): New.
> > (translate_clast_for): Add a condition around the loop, to do not
> > execute loops with zero iterations.
> > * testsuite/g++.dg/graphite/pr42130.C: New.
> > * testsuite/gcc.dg/graphite/pr35356-2.c: Adapt.
> > ---
> > gcc/ChangeLog.graphite | 10 ++++
> > gcc/graphite-clast-to-gimple.c | 84 ++++++++++++++++++++++++++++-
> > gcc/testsuite/g++.dg/graphite/pr42130.C | 18 ++++++
> > gcc/testsuite/gcc.dg/graphite/pr35356-2.c | 16 +++++-
> > 4 files changed, 124 insertions(+), 4 deletions(-)
> > create mode 100644 gcc/testsuite/g++.dg/graphite/pr42130.C
> >
> > diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
> > index c705cbd..863b0be 100644
> > --- a/gcc/ChangeLog.graphite
> > +++ b/gcc/ChangeLog.graphite
> > @@ -1,5 +1,15 @@
> > 2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
> >
> > + PR middle-end/42130
> > + * graphite-clast-to-gimple.c (graphite_create_new_loop_guard,
> > + translate_clast_for_loop): New.
> > + (translate_clast_for): Add a condition around the loop, to do not
> > + execute loops with zero iterations.
> > + * testsuite/g++.dg/graphite/pr42130.C: New.
> > + * testsuite/gcc.dg/graphite/pr35356-2.c: Adapt.
> > +
> > +2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
> > +
> > * graphite-clast-to-gimple.c (try_mark_loop_parallel): New.
> > (translate_clast_for, translate_clast_guard, translate_clast, gloog):
> > Remove context_loop and level.
> > diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
> > index 4f45708..3795f6f 100644
> > --- a/gcc/graphite-clast-to-gimple.c
> > +++ b/gcc/graphite-clast-to-gimple.c
> > @@ -768,8 +768,47 @@ try_mark_loop_parallel (sese region, loop_p loop, htab_t bb_pbb_mapping)
> > loop->can_be_parallel = true;
> > }
> >
> > +static tree gcc_type_for_iv_of_clast_loop (struct clast_for *);
> >
> > -/* Translates a clast for statement STMT to gimple.
> > +
> > +/* Creates a new if region protecting the loop to be executed, if the execution
> > + * count is zero (lb > ub). */
>
> GCC coding-style does not want the leading '*' on the second line
> of the comment.
>
> Also seen below again.
>
> Richard.
Already fixed in Patch 6/7. I just moved the changes from the graphite
branch. Probably I could have merged them before, however this would
make merge tracking harder.
Maybe I merge the changes but keep the two commit messages the next
time.
Thanks for your review
Tobi
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 7/7] Correct testcase
2009-11-30 22:11 [PATCH 0/7] Fix SPEC2006 dealII with graphite enabled - committed Tobias Grosser
2009-11-30 22:11 ` [PATCH 5/7] Protect loops that might be executed zero times Tobias Grosser
@ 2009-11-30 22:11 ` Tobias Grosser
2009-11-30 22:11 ` [PATCH 1/7] Do not abuse sese for codegeneration Tobias Grosser
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Tobias Grosser @ 2009-11-30 22:11 UTC (permalink / raw)
To: gcc-patches
From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>
2009-11-29 Alexander Monakov <amonakov@gcc.gnu.org>
* testsuite/g++.dg/graphite/pr42130.C: Correct testcase.
---
gcc/ChangeLog.graphite | 4 ++++
gcc/testsuite/g++.dg/graphite/pr42130.C | 5 +++--
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index e9e9806..3ae2075 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,7 @@
+2009-11-29 Alexander Monakov <amonakov@gcc.gnu.org>
+
+ * testsuite/g++.dg/graphite/pr42130.C: Correct testcase.
+
2009-11-24 Tobias Grosser <grosser@fim.uni-passau.de>
* graphite-clast-to-gimple.c (try_mark_loop_parallel,
diff --git a/gcc/testsuite/g++.dg/graphite/pr42130.C b/gcc/testsuite/g++.dg/graphite/pr42130.C
index 92d3bd8..ca00227 100644
--- a/gcc/testsuite/g++.dg/graphite/pr42130.C
+++ b/gcc/testsuite/g++.dg/graphite/pr42130.C
@@ -3,7 +3,7 @@
using std::vector;
-vector<unsigned> & __attribute__((noinline)) foo(unsigned n, unsigned k)
+vector<unsigned> & __attribute__((noinline, noclone)) foo(unsigned n)
{
vector<unsigned> *vv = new vector<unsigned>(n, 0u);
return *vv;
@@ -12,7 +12,8 @@ vector<unsigned> & __attribute__((noinline)) foo(unsigned n, unsigned k)
int main()
{
- foo(0, 1);
+ foo(0);
+ return 0;
}
/* { dg-do run } */
--
1.6.5.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 1/7] Do not abuse sese for codegeneration
2009-11-30 22:11 [PATCH 0/7] Fix SPEC2006 dealII with graphite enabled - committed Tobias Grosser
2009-11-30 22:11 ` [PATCH 5/7] Protect loops that might be executed zero times Tobias Grosser
2009-11-30 22:11 ` [PATCH 7/7] Correct testcase Tobias Grosser
@ 2009-11-30 22:11 ` Tobias Grosser
2009-11-30 22:11 ` [PATCH 4/7] Remove context_loop and level from translate_clast_* methods Tobias Grosser
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Tobias Grosser @ 2009-11-30 22:11 UTC (permalink / raw)
To: gcc-patches
From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>
CLooG automatically frees the names list, so sharing SESE_PARAMS_NAMES
between gloog() and debug_generated_program() leads to freeing them
twice. As both SESE_PARAM_NAMES and SESE_PARAMS_INDEX are code
generation data structures remove them and the functions working on them
from sese.h and put them in clast-to-gimple.
2009-11-21 Tobias Grosser <grosser@fim.uni-passau.de>
* graphite-clast-to-gimple.c (clast_name_index, new_clast_name_index,
clast_name_to_index, save_clast_name_index, debug_clast_name_index,
debug_clast_name_indexes_1, debug_clast_name_indexes,
clast_name_index_elt_info, eq_clast_name_indexes): Moved from sese.h.
(clast_name_to_gcc, clast_to_gcc_expression,
clast_to_gcc_expression_red, gcc_type_for_clast_expr,
gcc_type_for_clast_eq, graphite_translate_clast_equation,
graphite_create_guard_cond_expr, graphite_create_new_loop,
translate_clast): Add params_index.
(initialize_cloog_names): Create parameter strings from scratch, do
not reference other strings.
(create_params_index): New.
(gloog): Initialize params_index.
* graphite-scop-detection (free_scops_1): Removed.
(limit_scops): Use normal free_scops.
* graphite-sese-to-poly.c (save_var_names): Removed.
(parameter_index_in_region): Do not initialize SESE_PARAM_NAMES
and SESE_PARAMS_INDEX.
* sese.c (new_sese, free_sese): Dito.
* sese.h (struct sese): Remove params_index, params_names.
(SESE_PARAMS_INDEX, SESE_PARAMS_NAMES): Removed.
---
gcc/ChangeLog.graphite | 24 ++++
gcc/graphite-clast-to-gimple.c | 255 +++++++++++++++++++++++++++++++---------
gcc/graphite-scop-detection.c | 20 +---
gcc/graphite-sese-to-poly.c | 23 ----
gcc/sese.c | 8 --
gcc/sese.h | 107 -----------------
6 files changed, 224 insertions(+), 213 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 53ffd93..3f5a431 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,27 @@
+2009-11-21 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-clast-to-gimple.c (clast_name_index, new_clast_name_index,
+ clast_name_to_index, save_clast_name_index, debug_clast_name_index,
+ debug_clast_name_indexes_1, debug_clast_name_indexes,
+ clast_name_index_elt_info, eq_clast_name_indexes): Moved from sese.h.
+ (clast_name_to_gcc, clast_to_gcc_expression,
+ clast_to_gcc_expression_red, gcc_type_for_clast_expr,
+ gcc_type_for_clast_eq, graphite_translate_clast_equation,
+ graphite_create_guard_cond_expr, graphite_create_new_loop,
+ translate_clast): Add params_index.
+ (initialize_cloog_names): Create parameter strings from scratch, do
+ not reference other strings.
+ (create_params_index): New.
+ (gloog): Initialize params_index.
+ * graphite-scop-detection (free_scops_1): Removed.
+ (limit_scops): Use normal free_scops.
+ * graphite-sese-to-poly.c (save_var_names): Removed.
+ (parameter_index_in_region): Do not initialize SESE_PARAM_NAMES
+ and SESE_PARAMS_INDEX.
+ * sese.c (new_sese, free_sese): Dito.
+ * sese.h (struct sese): Remove params_index, params_names.
+ (SESE_PARAMS_INDEX, SESE_PARAMS_NAMES): Removed.
+
2009-11-20 Sebastian Pop <sebastian.pop@amd.com>
Revert the following patch from 2009-09-14:
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 3f3bb3b..f4a7840 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -66,6 +66,106 @@ graphite_verify (void)
#endif
}
+/* Stores the INDEX in a vector for a given clast NAME. */
+
+typedef struct clast_name_index {
+ int index;
+ const char *name;
+} *clast_name_index_p;
+
+/* Returns a pointer to a new element of type clast_name_index_p built
+ from NAME and INDEX. */
+
+static inline clast_name_index_p
+new_clast_name_index (const char *name, int index)
+{
+ clast_name_index_p res = XNEW (struct clast_name_index);
+
+ res->name = name;
+ res->index = index;
+ return res;
+}
+
+/* For a given clast NAME, returns -1 if it does not correspond to any
+ parameter, or otherwise, returns the index in the PARAMS or
+ SCATTERING_DIMENSIONS vector. */
+
+static inline int
+clast_name_to_index (const char *name, htab_t index_table)
+{
+ struct clast_name_index tmp;
+ PTR *slot;
+
+ tmp.name = name;
+ slot = htab_find_slot (index_table, &tmp, NO_INSERT);
+
+ if (slot && *slot)
+ return ((struct clast_name_index *) *slot)->index;
+
+ return -1;
+}
+
+/* Records in INDEX_TABLE the INDEX for NAME. */
+
+static inline void
+save_clast_name_index (htab_t index_table, const char *name, int index)
+{
+ struct clast_name_index tmp;
+ PTR *slot;
+
+ tmp.name = name;
+ slot = htab_find_slot (index_table, &tmp, INSERT);
+
+ if (slot)
+ *slot = new_clast_name_index (name, index);
+}
+
+/* Print to stderr the element ELT. */
+
+static inline void
+debug_clast_name_index (clast_name_index_p elt)
+{
+ fprintf (stderr, "(index = %d, name = %s)\n", elt->index, elt->name);
+}
+
+/* Helper function for debug_rename_map. */
+
+static inline int
+debug_clast_name_indexes_1 (void **slot, void *s ATTRIBUTE_UNUSED)
+{
+ struct clast_name_index *entry = (struct clast_name_index *) *slot;
+ debug_clast_name_index (entry);
+ return 1;
+}
+
+/* Print to stderr all the elements of MAP. */
+
+void
+debug_clast_name_indexes (htab_t map)
+{
+ htab_traverse (map, debug_clast_name_indexes_1, NULL);
+}
+
+/* Computes a hash function for database element ELT. */
+
+static inline hashval_t
+clast_name_index_elt_info (const void *elt)
+{
+ return htab_hash_pointer (((const struct clast_name_index *) elt)->name);
+}
+
+/* Compares database elements E1 and E2. */
+
+static inline int
+eq_clast_name_indexes (const void *e1, const void *e2)
+{
+ const struct clast_name_index *elt1 = (const struct clast_name_index *) e1;
+ const struct clast_name_index *elt2 = (const struct clast_name_index *) e2;
+
+ return (elt1->name == elt2->name);
+}
+
+
/* For a given loop DEPTH in the loop nest of the original black box
PBB, return the old induction variable associated to that loop. */
@@ -95,11 +195,10 @@ newivs_to_depth_to_newiv (VEC (tree, heap) *newivs, int depth)
static tree
clast_name_to_gcc (const char *name, sese region, VEC (tree, heap) *newivs,
- htab_t newivs_index)
+ htab_t newivs_index, htab_t params_index)
{
int index;
VEC (tree, heap) *params = SESE_PARAMS (region);
- htab_t params_index = SESE_PARAMS_INDEX (region);
if (params && params_index)
{
@@ -128,7 +227,7 @@ max_precision_type (tree e1, tree e2)
static tree
clast_to_gcc_expression (tree, struct clast_expr *, sese, VEC (tree, heap) *,
- htab_t);
+ htab_t, htab_t);
/* Converts a Cloog reduction expression R with reduction operation OP
to a GCC expression tree of type TYPE. */
@@ -137,17 +236,17 @@ static tree
clast_to_gcc_expression_red (tree type, enum tree_code op,
struct clast_reduction *r,
sese region, VEC (tree, heap) *newivs,
- htab_t newivs_index)
+ htab_t newivs_index, htab_t params_index)
{
int i;
tree res = clast_to_gcc_expression (type, r->elts[0], region, newivs,
- newivs_index);
+ newivs_index, params_index);
tree operand_type = (op == POINTER_PLUS_EXPR) ? sizetype : type;
for (i = 1; i < r->n; i++)
{
tree t = clast_to_gcc_expression (operand_type, r->elts[i], region,
- newivs, newivs_index);
+ newivs, newivs_index, params_index);
res = fold_build2 (op, type, res, t);
}
@@ -160,7 +259,7 @@ clast_to_gcc_expression_red (tree type, enum tree_code op,
static tree
clast_to_gcc_expression (tree type, struct clast_expr *e,
sese region, VEC (tree, heap) *newivs,
- htab_t newivs_index)
+ htab_t newivs_index, htab_t params_index)
{
switch (e->type)
{
@@ -173,21 +272,21 @@ clast_to_gcc_expression (tree type, struct clast_expr *e,
if (value_one_p (t->val))
{
tree name = clast_name_to_gcc (t->var, region, newivs,
- newivs_index);
+ newivs_index, params_index);
return fold_convert (type, name);
}
else if (value_mone_p (t->val))
{
tree name = clast_name_to_gcc (t->var, region, newivs,
- newivs_index);
+ newivs_index, params_index);
name = fold_convert (type, name);
return fold_build1 (NEGATE_EXPR, type, name);
}
else
{
tree name = clast_name_to_gcc (t->var, region, newivs,
- newivs_index);
+ newivs_index, params_index);
tree cst = gmp_cst_to_tree (type, t->val);
name = fold_convert (type, name);
return fold_build2 (MULT_EXPR, type, cst, name);
@@ -206,15 +305,17 @@ clast_to_gcc_expression (tree type, struct clast_expr *e,
case clast_red_sum:
return clast_to_gcc_expression_red
(type, POINTER_TYPE_P (type) ? POINTER_PLUS_EXPR : PLUS_EXPR,
- r, region, newivs, newivs_index);
+ r, region, newivs, newivs_index, params_index);
case clast_red_min:
return clast_to_gcc_expression_red (type, MIN_EXPR, r, region,
- newivs, newivs_index);
+ newivs, newivs_index,
+ params_index);
case clast_red_max:
return clast_to_gcc_expression_red (type, MAX_EXPR, r, region,
- newivs, newivs_index);
+ newivs, newivs_index,
+ params_index);
default:
gcc_unreachable ();
@@ -227,7 +328,7 @@ clast_to_gcc_expression (tree type, struct clast_expr *e,
struct clast_binary *b = (struct clast_binary *) e;
struct clast_expr *lhs = (struct clast_expr *) b->LHS;
tree tl = clast_to_gcc_expression (type, lhs, region, newivs,
- newivs_index);
+ newivs_index, params_index);
tree tr = gmp_cst_to_tree (type, b->RHS);
switch (b->type)
@@ -261,7 +362,7 @@ clast_to_gcc_expression (tree type, struct clast_expr *e,
static tree
gcc_type_for_clast_expr (struct clast_expr *e,
sese region, VEC (tree, heap) *newivs,
- htab_t newivs_index)
+ htab_t newivs_index, htab_t params_index)
{
switch (e->type)
{
@@ -271,7 +372,7 @@ gcc_type_for_clast_expr (struct clast_expr *e,
if (t->var)
return TREE_TYPE (clast_name_to_gcc (t->var, region, newivs,
- newivs_index));
+ newivs_index, params_index));
else
return NULL_TREE;
}
@@ -282,14 +383,15 @@ gcc_type_for_clast_expr (struct clast_expr *e,
if (r->n == 1)
return gcc_type_for_clast_expr (r->elts[0], region, newivs,
- newivs_index);
+ newivs_index, params_index);
else
{
int i;
for (i = 0; i < r->n; i++)
{
tree type = gcc_type_for_clast_expr (r->elts[i], region,
- newivs, newivs_index);
+ newivs, newivs_index,
+ params_index);
if (type)
return type;
}
@@ -302,7 +404,7 @@ gcc_type_for_clast_expr (struct clast_expr *e,
struct clast_binary *b = (struct clast_binary *) e;
struct clast_expr *lhs = (struct clast_expr *) b->LHS;
return gcc_type_for_clast_expr (lhs, region, newivs,
- newivs_index);
+ newivs_index, params_index);
}
default:
@@ -317,14 +419,15 @@ gcc_type_for_clast_expr (struct clast_expr *e,
static tree
gcc_type_for_clast_eq (struct clast_equation *cleq,
sese region, VEC (tree, heap) *newivs,
- htab_t newivs_index)
+ htab_t newivs_index, htab_t params_index)
{
tree type = gcc_type_for_clast_expr (cleq->LHS, region, newivs,
- newivs_index);
+ newivs_index, params_index);
if (type)
return type;
- return gcc_type_for_clast_expr (cleq->RHS, region, newivs, newivs_index);
+ return gcc_type_for_clast_expr (cleq->RHS, region, newivs, newivs_index,
+ params_index);
}
/* Translates a clast equation CLEQ to a tree. */
@@ -333,14 +436,15 @@ static tree
graphite_translate_clast_equation (sese region,
struct clast_equation *cleq,
VEC (tree, heap) *newivs,
- htab_t newivs_index)
+ htab_t newivs_index, htab_t params_index)
{
enum tree_code comp;
- tree type = gcc_type_for_clast_eq (cleq, region, newivs, newivs_index);
+ tree type = gcc_type_for_clast_eq (cleq, region, newivs, newivs_index,
+ params_index);
tree lhs = clast_to_gcc_expression (type, cleq->LHS, region, newivs,
- newivs_index);
+ newivs_index, params_index);
tree rhs = clast_to_gcc_expression (type, cleq->RHS, region, newivs,
- newivs_index);
+ newivs_index, params_index);
if (cleq->sign == 0)
comp = EQ_EXPR;
@@ -359,7 +463,7 @@ graphite_translate_clast_equation (sese region,
static tree
graphite_create_guard_cond_expr (sese region, struct clast_guard *stmt,
VEC (tree, heap) *newivs,
- htab_t newivs_index)
+ htab_t newivs_index, htab_t params_index)
{
tree cond = NULL;
int i;
@@ -367,7 +471,8 @@ graphite_create_guard_cond_expr (sese region, struct clast_guard *stmt,
for (i = 0; i < stmt->n; i++)
{
tree eq = graphite_translate_clast_equation (region, &stmt->eq[i],
- newivs, newivs_index);
+ newivs, newivs_index,
+ params_index);
if (cond)
cond = fold_build2 (TRUTH_AND_EXPR, TREE_TYPE (eq), cond, eq);
@@ -384,10 +489,10 @@ static edge
graphite_create_new_guard (sese region, edge entry_edge,
struct clast_guard *stmt,
VEC (tree, heap) *newivs,
- htab_t newivs_index)
+ htab_t newivs_index, htab_t params_index)
{
tree cond_expr = graphite_create_guard_cond_expr (region, stmt, newivs,
- newivs_index);
+ newivs_index, params_index);
edge exit_edge = create_empty_if_region_on_edge (entry_edge, cond_expr);
return exit_edge;
}
@@ -460,13 +565,13 @@ static struct loop *
graphite_create_new_loop (sese region, edge entry_edge,
struct clast_for *stmt,
loop_p outer, VEC (tree, heap) **newivs,
- htab_t newivs_index)
+ htab_t newivs_index, htab_t params_index)
{
tree type = gcc_type_for_iv_of_clast_loop (stmt);
tree lb = clast_to_gcc_expression (type, stmt->LB, region, *newivs,
- newivs_index);
+ newivs_index, params_index);
tree ub = clast_to_gcc_expression (type, stmt->UB, region, *newivs,
- newivs_index);
+ newivs_index, params_index);
tree stride = gmp_cst_to_tree (type, stmt->stride);
tree ivvar = create_tmp_var (type, "graphite_IV");
tree iv, iv_after_increment;
@@ -488,7 +593,8 @@ graphite_create_new_loop (sese region, edge entry_edge,
static void
build_iv_mapping (htab_t map, sese region,
VEC (tree, heap) *newivs, htab_t newivs_index,
- struct clast_user_stmt *user_stmt)
+ struct clast_user_stmt *user_stmt,
+ htab_t params_index)
{
struct clast_stmt *t;
int index = 0;
@@ -500,10 +606,10 @@ build_iv_mapping (htab_t map, sese region,
struct clast_expr *expr = (struct clast_expr *)
((struct clast_assignment *)t)->RHS;
tree type = gcc_type_for_clast_expr (expr, region, newivs,
- newivs_index);
+ newivs_index, params_index);
tree old_name = pbb_to_depth_to_oldiv (pbb, index);
tree e = clast_to_gcc_expression (type, expr, region, newivs,
- newivs_index);
+ newivs_index, params_index);
set_rename (map, old_name, e);
}
}
@@ -626,7 +732,8 @@ static edge
translate_clast (sese region, struct loop *context_loop,
struct clast_stmt *stmt, edge next_e,
htab_t rename_map, VEC (tree, heap) **newivs,
- htab_t newivs_index, htab_t bb_pbb_mapping, int level)
+ htab_t newivs_index, htab_t bb_pbb_mapping, int level,
+ htab_t params_index)
{
if (!stmt)
return next_e;
@@ -634,7 +741,7 @@ translate_clast (sese region, struct loop *context_loop,
if (CLAST_STMT_IS_A (stmt, stmt_root))
return translate_clast (region, context_loop, stmt->next, next_e,
rename_map, newivs, newivs_index,
- bb_pbb_mapping, level);
+ bb_pbb_mapping, level, params_index);
if (CLAST_STMT_IS_A (stmt, stmt_user))
{
@@ -648,7 +755,7 @@ translate_clast (sese region, struct loop *context_loop,
return next_e;
build_iv_mapping (rename_map, region, *newivs, newivs_index,
- (struct clast_user_stmt *) stmt);
+ (struct clast_user_stmt *) stmt, params_index);
next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb), region,
next_e, rename_map);
new_bb = next_e->src;
@@ -658,7 +765,7 @@ translate_clast (sese region, struct loop *context_loop,
graphite_verify ();
return translate_clast (region, context_loop, stmt->next, next_e,
rename_map, newivs, newivs_index,
- bb_pbb_mapping, level);
+ bb_pbb_mapping, level, params_index);
}
if (CLAST_STMT_IS_A (stmt, stmt_for))
@@ -666,7 +773,8 @@ translate_clast (sese region, struct loop *context_loop,
struct clast_for *stmtfor = (struct clast_for *)stmt;
struct loop *loop
= graphite_create_new_loop (region, next_e, stmtfor,
- context_loop, newivs, newivs_index);
+ context_loop, newivs, newivs_index,
+ params_index);
edge last_e = single_exit (loop);
edge to_body = single_succ_edge (loop->header);
basic_block after = to_body->dest;
@@ -678,7 +786,7 @@ translate_clast (sese region, struct loop *context_loop,
next_e = translate_clast
(region, loop, ((struct clast_for *) stmt)->body,
single_succ_edge (loop->header), rename_map, newivs,
- newivs_index, bb_pbb_mapping, level + 1);
+ newivs_index, bb_pbb_mapping, level + 1, params_index);
redirect_edge_succ_nodup (next_e, after);
set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src);
@@ -695,14 +803,15 @@ translate_clast (sese region, struct loop *context_loop,
graphite_verify ();
return translate_clast (region, context_loop, stmt->next, last_e,
rename_map, newivs, newivs_index,
- bb_pbb_mapping, level);
+ bb_pbb_mapping, level, params_index);
}
if (CLAST_STMT_IS_A (stmt, stmt_guard))
{
edge last_e = graphite_create_new_guard (region, next_e,
((struct clast_guard *) stmt),
- *newivs, newivs_index);
+ *newivs, newivs_index,
+ params_index);
edge true_e = get_true_edge_from_guard_bb (next_e->dest);
edge false_e = get_false_edge_from_guard_bb (next_e->dest);
edge exit_true_e = single_succ_edge (true_e->dest);
@@ -714,7 +823,7 @@ translate_clast (sese region, struct loop *context_loop,
next_e = translate_clast (region, context_loop,
((struct clast_guard *) stmt)->then,
true_e, rename_map, newivs, newivs_index,
- bb_pbb_mapping, level);
+ bb_pbb_mapping, level, params_index);
insert_guard_phis (last_e->src, exit_true_e, exit_false_e,
before_guard, rename_map);
@@ -724,7 +833,7 @@ translate_clast (sese region, struct loop *context_loop,
return translate_clast (region, context_loop, stmt->next, last_e,
rename_map, newivs, newivs_index,
- bb_pbb_mapping, level);
+ bb_pbb_mapping, level, params_index);
}
if (CLAST_STMT_IS_A (stmt, stmt_block))
@@ -732,12 +841,12 @@ translate_clast (sese region, struct loop *context_loop,
next_e = translate_clast (region, context_loop,
((struct clast_block *) stmt)->body,
next_e, rename_map, newivs, newivs_index,
- bb_pbb_mapping, level);
+ bb_pbb_mapping, level, params_index);
recompute_all_dominators ();
graphite_verify ();
return translate_clast (region, context_loop, stmt->next, next_e,
rename_map, newivs, newivs_index,
- bb_pbb_mapping, level);
+ bb_pbb_mapping, level, params_index);
}
gcc_unreachable ();
@@ -890,14 +999,30 @@ initialize_cloog_names (scop_p scop, CloogProgram *prog)
int i;
int nb_iterators = scop_max_loop_depth (scop);
int nb_scattering = cloog_program_nb_scattdims (prog);
+ int nb_parameters = VEC_length (tree, SESE_PARAMS (region));
char **iterators = XNEWVEC (char *, nb_iterators * 2);
char **scattering = XNEWVEC (char *, nb_scattering);
+ char **parameters= XNEWVEC (char *, nb_parameters);
cloog_program_set_names (prog, cloog_names_malloc ());
- cloog_names_set_nb_parameters (cloog_program_names (prog),
- VEC_length (tree, SESE_PARAMS (region)));
- cloog_names_set_parameters (cloog_program_names (prog),
- SESE_PARAMS_NAMES (region));
+
+ for (i = 0; i < nb_parameters; i++)
+ {
+ tree param = VEC_index (tree, SESE_PARAMS(region), i);
+ const char *name = get_name (param);
+ int len;
+
+ if (!name)
+ name = "T";
+
+ len = strlen (name);
+ len += 17;
+ parameters[i] = XNEWVEC (char, len + 1);
+ snprintf (parameters[i], len, "%s_%d", name, SSA_NAME_VERSION (param));
+ }
+
+ cloog_names_set_nb_parameters (cloog_program_names (prog), nb_parameters);
+ cloog_names_set_parameters (cloog_program_names (prog), parameters);
for (i = 0; i < nb_iterators; i++)
{
@@ -1144,6 +1269,20 @@ debug_generated_program (scop_p scop)
print_generated_program (stderr, scop);
}
+/* Add CLooG names to parameter index. The index is used to translate back from
+ * CLooG names to GCC trees. */
+
+static void
+create_params_index (htab_t index_table, CloogProgram *prog) {
+ CloogNames* names = cloog_program_names (prog);
+ int nb_parameters = cloog_names_nb_parameters (names);
+ char **parameters = cloog_names_parameters (names);
+ int i;
+
+ for (i = 0; i < nb_parameters; i++)
+ save_clast_name_index (index_table, parameters[i], i);
+}
+
/* GIMPLE Loop Generator: generates loops from STMT in GIMPLE form for
the given SCOP. Return true if code generation succeeded.
BB_PBB_MAPPING is a basic_block and it's related poly_bb_p mapping.
@@ -1157,7 +1296,7 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
loop_p context_loop;
sese region = SCOP_REGION (scop);
ifsese if_region = NULL;
- htab_t rename_map, newivs_index;
+ htab_t rename_map, newivs_index, params_index;
cloog_prog_clast pc;
timevar_push (TV_GRAPHITE_CODE_GEN);
@@ -1179,20 +1318,23 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
if_region->region->exit->src,
if_region->false_region->exit,
if_region->true_region->exit);
-
recompute_all_dominators ();
graphite_verify ();
+
context_loop = SESE_ENTRY (region)->src->loop_father;
compute_cloog_iv_types (pc.stmt);
-
rename_map = htab_create (10, rename_map_elt_info, eq_rename_map_elts, free);
newivs_index = htab_create (10, clast_name_index_elt_info,
eq_clast_name_indexes, free);
+ params_index = htab_create (10, clast_name_index_elt_info,
+ eq_clast_name_indexes, free);
+
+ create_params_index (params_index, pc.prog);
new_scop_exit_edge = translate_clast (region, context_loop, pc.stmt,
if_region->true_region->entry,
rename_map, &newivs, newivs_index,
- bb_pbb_mapping, 1);
+ bb_pbb_mapping, 1, params_index);
graphite_verify ();
sese_adjust_liveout_phis (region, rename_map,
if_region->region->exit->src,
@@ -1207,6 +1349,7 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
htab_delete (rename_map);
htab_delete (newivs_index);
+ htab_delete (params_index);
VEC_free (tree, heap, newivs);
cloog_clast_free (pc.stmt);
cloog_program_free (pc.prog);
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 6580252..02c653b 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1207,24 +1207,6 @@ print_graphite_statistics (FILE* file, VEC (scop_p, heap) *scops)
print_graphite_scop_statistics (file, scop);
}
-/* Version of free_scops special cased for limit_scops. */
-
-static void
-free_scops_1 (VEC (scop_p, heap) **scops)
-{
- int i;
- scop_p scop;
-
- for (i = 0; VEC_iterate (scop_p, *scops, i, scop); i++)
- {
- sese region = SCOP_REGION (scop);
- free (SESE_PARAMS_NAMES (region));
- SESE_PARAMS_NAMES (region) = 0;
- }
-
- free_scops (*scops);
-}
-
/* We limit all SCoPs to SCoPs, that are completely surrounded by a loop.
Example:
@@ -1278,7 +1260,7 @@ limit_scops (VEC (scop_p, heap) **scops)
}
}
- free_scops_1 (scops);
+ free_scops (*scops);
*scops = VEC_alloc (scop_p, heap, 3);
create_sese_edges (regions);
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index d3a2403..37b2035 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -746,26 +746,6 @@ scan_tree_for_params_int (tree cst, ppl_Linear_Expression_t expr, Value k)
ppl_delete_Coefficient (coef);
}
-/* Saves in NV at index I a new name for variable P. */
-
-static void
-save_var_name (char **nv, int i, tree p)
-{
- const char *name = get_name (SSA_NAME_VAR (p));
-
- if (name)
- {
- int len = strlen (name) + 16;
- nv[i] = XNEWVEC (char, len);
- snprintf (nv[i], len, "%s_%d", name, SSA_NAME_VERSION (p));
- }
- else
- {
- nv[i] = XNEWVEC (char, 16);
- snprintf (nv[i], 2 + 16, "T_%d", SSA_NAME_VERSION (p));
- }
-}
-
/* When parameter NAME is in REGION, returns its index in SESE_PARAMS.
Otherwise returns -1. */
@@ -802,9 +782,6 @@ parameter_index_in_region (tree name, sese region)
gcc_assert (SESE_ADD_PARAMS (region));
i = VEC_length (tree, SESE_PARAMS (region));
- save_var_name (SESE_PARAMS_NAMES (region), i, name);
- save_clast_name_index (SESE_PARAMS_INDEX (region),
- SESE_PARAMS_NAMES (region)[i], i);
VEC_safe_push (tree, heap, SESE_PARAMS (region), name);
return i;
}
diff --git a/gcc/sese.c b/gcc/sese.c
index 338f482..2c03393 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -332,9 +332,6 @@ new_sese (edge entry, edge exit)
SESE_LOOP_NEST (region) = VEC_alloc (loop_p, heap, 3);
SESE_ADD_PARAMS (region) = true;
SESE_PARAMS (region) = VEC_alloc (tree, heap, 3);
- SESE_PARAMS_INDEX (region) = htab_create (10, clast_name_index_elt_info,
- eq_clast_name_indexes, free);
- SESE_PARAMS_NAMES (region) = XNEWVEC (char *, num_ssa_names);
return region;
}
@@ -350,11 +347,6 @@ free_sese (sese region)
VEC_free (tree, heap, SESE_PARAMS (region));
VEC_free (loop_p, heap, SESE_LOOP_NEST (region));
- if (SESE_PARAMS_INDEX (region))
- htab_delete (SESE_PARAMS_INDEX (region));
-
- /* Do not free SESE_PARAMS_NAMES: CLooG does that. */
-
XDELETE (region);
}
diff --git a/gcc/sese.h b/gcc/sese.h
index c126a69..6763db3 100644
--- a/gcc/sese.h
+++ b/gcc/sese.h
@@ -32,12 +32,6 @@ typedef struct sese_s
/* Parameters used within the SCOP. */
VEC (tree, heap) *params;
- /* Used to quickly retrieve the index of a parameter in PARAMS. */
- htab_t params_index;
-
- /* Store the names of the parameters that are passed to CLooG. */
- char **params_names;
-
/* Loops completely contained in the SCOP. */
bitmap loops;
VEC (loop_p, heap) *loop_nest;
@@ -53,8 +47,6 @@ typedef struct sese_s
#define SESE_EXIT(S) (S->exit)
#define SESE_EXIT_BB(S) (S->exit->dest)
#define SESE_PARAMS(S) (S->params)
-#define SESE_PARAMS_INDEX(S) (S->params_index)
-#define SESE_PARAMS_NAMES(S) (S->params_names)
#define SESE_LOOPS(S) (S->loops)
#define SESE_LOOP_NEST(S) (S->loop_nest)
#define SESE_ADD_PARAMS(S) (S->add_params)
@@ -222,105 +214,6 @@ block_before_sese (sese sese)
return SESE_ENTRY (sese)->src;
}
-/* Stores the INDEX in a vector for a given clast NAME. */
-
-typedef struct clast_name_index {
- int index;
- const char *name;
-} *clast_name_index_p;
-
-/* Returns a pointer to a new element of type clast_name_index_p built
- from NAME and INDEX. */
-
-static inline clast_name_index_p
-new_clast_name_index (const char *name, int index)
-{
- clast_name_index_p res = XNEW (struct clast_name_index);
-
- res->name = name;
- res->index = index;
- return res;
-}
-
-/* For a given clast NAME, returns -1 if it does not correspond to any
- parameter, or otherwise, returns the index in the PARAMS or
- SCATTERING_DIMENSIONS vector. */
-
-static inline int
-clast_name_to_index (const char *name, htab_t index_table)
-{
- struct clast_name_index tmp;
- PTR *slot;
-
- tmp.name = name;
- slot = htab_find_slot (index_table, &tmp, NO_INSERT);
-
- if (slot && *slot)
- return ((struct clast_name_index *) *slot)->index;
-
- return -1;
-}
-
-/* Records in INDEX_TABLE the INDEX for NAME. */
-
-static inline void
-save_clast_name_index (htab_t index_table, const char *name, int index)
-{
- struct clast_name_index tmp;
- PTR *slot;
-
- tmp.name = name;
- slot = htab_find_slot (index_table, &tmp, INSERT);
-
- if (slot)
- *slot = new_clast_name_index (name, index);
-}
-
-/* Print to stderr the element ELT. */
-
-static inline void
-debug_clast_name_index (clast_name_index_p elt)
-{
- fprintf (stderr, "(index = %d, name = %s)\n", elt->index, elt->name);
-}
-
-/* Helper function for debug_rename_map. */
-
-static inline int
-debug_clast_name_indexes_1 (void **slot, void *s ATTRIBUTE_UNUSED)
-{
- struct clast_name_index *entry = (struct clast_name_index *) *slot;
- debug_clast_name_index (entry);
- return 1;
-}
-
-/* Print to stderr all the elements of MAP. */
-
-static inline void
-debug_clast_name_indexes (htab_t map)
-{
- htab_traverse (map, debug_clast_name_indexes_1, NULL);
-}
-
-/* Computes a hash function for database element ELT. */
-
-static inline hashval_t
-clast_name_index_elt_info (const void *elt)
-{
- return htab_hash_pointer (((const struct clast_name_index *) elt)->name);
-}
-
-/* Compares database elements E1 and E2. */
-
-static inline int
-eq_clast_name_indexes (const void *e1, const void *e2)
-{
- const struct clast_name_index *elt1 = (const struct clast_name_index *) e1;
- const struct clast_name_index *elt2 = (const struct clast_name_index *) e2;
-
- return (elt1->name == elt2->name);
-}
-
\f
/* A single entry single exit specialized for conditions. */
--
1.6.5.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 4/7] Remove context_loop and level from translate_clast_* methods.
2009-11-30 22:11 [PATCH 0/7] Fix SPEC2006 dealII with graphite enabled - committed Tobias Grosser
` (2 preceding siblings ...)
2009-11-30 22:11 ` [PATCH 1/7] Do not abuse sese for codegeneration Tobias Grosser
@ 2009-11-30 22:11 ` Tobias Grosser
2009-11-30 22:11 ` [PATCH 2/7] split translate_clast into single methods Tobias Grosser
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Tobias Grosser @ 2009-11-30 22:11 UTC (permalink / raw)
To: gcc-patches
From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>
2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
* graphite-clast-to-gimple.c (try_mark_loop_parallel): New.
(translate_clast_for, translate_clast_guard, translate_clast, gloog):
Remove context_loop and level.
---
gcc/ChangeLog.graphite | 6 ++
gcc/graphite-clast-to-gimple.c | 107 +++++++++++++++++++---------------------
2 files changed, 56 insertions(+), 57 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 49c11b2..c705cbd 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,11 @@
2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
+ * graphite-clast-to-gimple.c (try_mark_loop_parallel): New.
+ (translate_clast_for, translate_clast_guard, translate_clast, gloog):
+ Remove context_loop and level.
+
+2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
+
* graphite-clast-to-gimple.c (translate_clast_user,
translate_clast_for, translate_clast_guard): Simplify and move common
elements to translate_clast().
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index f708c76..4f45708 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -719,14 +719,13 @@ dependency_in_loop_p (loop_p loop, htab_t bb_pbb_mapping, int level)
}
static edge
-translate_clast (sese, loop_p, struct clast_stmt *, edge, htab_t,
- VEC (tree, heap) **, htab_t, htab_t, int, htab_t);
+translate_clast (sese, struct clast_stmt *, edge, htab_t, VEC (tree, heap) **,
+ htab_t, htab_t, htab_t);
/* Translates a clast user statement STMT to gimple.
- REGION is the sese region we used to generate the scop.
- NEXT_E is the edge where new generated code should be attached.
- - CONTEXT_LOOP is the loop in which the generated code will be placed
- RENAME_MAP contains a set of tuples of new names associated to
the original variables names.
- BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping.
@@ -738,10 +737,8 @@ translate_clast_user (sese region, struct clast_user_stmt *stmt, edge next_e,
htab_t newivs_index, htab_t bb_pbb_mapping,
htab_t params_index)
{
- gimple_bb_p gbb;
- basic_block new_bb;
poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (stmt->statement);
- gbb = PBB_BLACK_BOX (pbb);
+ gimple_bb_p gbb = PBB_BLACK_BOX (pbb);
if (GBB_BB (gbb) == ENTRY_BLOCK_PTR)
return next_e;
@@ -750,53 +747,57 @@ translate_clast_user (sese region, struct clast_user_stmt *stmt, edge next_e,
params_index);
next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb), region,
next_e, rename_map);
- new_bb = next_e->src;
- mark_bb_with_pbb (pbb, new_bb, bb_pbb_mapping);
+ mark_bb_with_pbb (pbb, next_e->src, bb_pbb_mapping);
update_ssa (TODO_update_ssa);
+
return next_e;
}
+/* Mark a loop parallel, if the graphite dependency check cannot find any
+ * dependencies. This triggers parallel code generation in the autopar pass.
+ * */
+static void
+try_mark_loop_parallel (sese region, loop_p loop, htab_t bb_pbb_mapping)
+{
+ loop_p outermost_loop = SESE_ENTRY (region)->src->loop_father;
+ int level = loop_depth (loop) - loop_depth (outermost_loop);
+
+ if (flag_loop_parallelize_all
+ && !dependency_in_loop_p (loop, bb_pbb_mapping,
+ get_scattering_level (level)))
+ loop->can_be_parallel = true;
+}
+
+
/* Translates a clast for statement STMT to gimple.
- REGION is the sese region we used to generate the scop.
- NEXT_E is the edge where new generated code should be attached.
- - CONTEXT_LOOP is the loop in which the generated code will be placed
- RENAME_MAP contains a set of tuples of new names associated to
the original variables names.
- BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping.
- PARAMS_INDEX connects the cloog parameters with the gimple parameters in
the sese region. */
static edge
-translate_clast_for (sese region, loop_p context_loop, struct clast_for *stmt,
- edge next_e, htab_t rename_map, VEC (tree, heap) **newivs,
- htab_t newivs_index, htab_t bb_pbb_mapping, int level,
+translate_clast_for (sese region, struct clast_for *stmt, edge next_e,
+ htab_t rename_map, VEC (tree, heap) **newivs,
+ htab_t newivs_index, htab_t bb_pbb_mapping,
htab_t params_index)
{
- struct loop *loop = graphite_create_new_loop (region, next_e, stmt,
- context_loop, newivs,
- newivs_index, params_index);
+ loop_p context_loop = next_e->dest->loop_father;
+ loop_p loop = graphite_create_new_loop (region, next_e, stmt, context_loop,
+ newivs, newivs_index, params_index);
edge last_e = single_exit (loop);
- edge to_body = single_succ_edge (loop->header);
- basic_block after = to_body->dest;
+ edge body = single_succ_edge (loop->header);
+
+ next_e = translate_clast (region, stmt->body, body, rename_map, newivs,
+ newivs_index, bb_pbb_mapping, params_index);
/* Create a basic block for loop close phi nodes. */
last_e = single_succ_edge (split_edge (last_e));
-
- /* Translate the body of the loop. */
- next_e = translate_clast (region, loop, stmt->body, to_body, rename_map,
- newivs, newivs_index, bb_pbb_mapping, level + 1,
- params_index);
- redirect_edge_succ_nodup (next_e, after);
- set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src);
-
- /* Remove from rename_map all the tuples containing variables
- defined in loop's body. */
insert_loop_close_phis (rename_map, loop);
- if (flag_loop_parallelize_all
- && !dependency_in_loop_p (loop, bb_pbb_mapping,
- get_scattering_level (level)))
- loop->can_be_parallel = true;
+ try_mark_loop_parallel (region, loop, bb_pbb_mapping);
return last_e;
}
@@ -805,17 +806,15 @@ translate_clast_for (sese region, loop_p context_loop, struct clast_for *stmt,
- REGION is the sese region we used to generate the scop.
- NEXT_E is the edge where new generated code should be attached.
- - CONTEXT_LOOP is the loop in which the generated code will be placed
- RENAME_MAP contains a set of tuples of new names associated to
the original variables names.
- BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping.
- PARAMS_INDEX connects the cloog parameters with the gimple parameters in
the sese region. */
static edge
-translate_clast_guard (sese region, loop_p context_loop,
- struct clast_guard *stmt, edge next_e,
+translate_clast_guard (sese region, struct clast_guard *stmt, edge next_e,
htab_t rename_map, VEC (tree, heap) **newivs,
- htab_t newivs_index, htab_t bb_pbb_mapping, int level,
+ htab_t newivs_index, htab_t bb_pbb_mapping,
htab_t params_index)
{
edge last_e = graphite_create_new_guard (region, next_e, stmt, *newivs,
@@ -830,9 +829,9 @@ translate_clast_guard (sese region, loop_p context_loop,
eq_rename_map_elts, free);
htab_traverse (rename_map, copy_renames, before_guard);
- next_e = translate_clast (region, context_loop, stmt->then, true_e,
+ next_e = translate_clast (region, stmt->then, true_e,
rename_map, newivs, newivs_index, bb_pbb_mapping,
- level, params_index);
+ params_index);
insert_guard_phis (last_e->src, exit_true_e, exit_false_e,
before_guard, rename_map);
@@ -846,14 +845,13 @@ translate_clast_guard (sese region, loop_p context_loop,
context of a SESE.
- NEXT_E is the edge where new generated code should be attached.
- - CONTEXT_LOOP is the loop in which the generated code will be placed
- RENAME_MAP contains a set of tuples of new names associated to
the original variables names.
- BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping. */
static edge
-translate_clast (sese region, loop_p context_loop, struct clast_stmt *stmt,
+translate_clast (sese region, struct clast_stmt *stmt,
edge next_e, htab_t rename_map, VEC (tree, heap) **newivs,
- htab_t newivs_index, htab_t bb_pbb_mapping, int level,
+ htab_t newivs_index, htab_t bb_pbb_mapping,
htab_t params_index)
{
if (!stmt)
@@ -868,31 +866,28 @@ translate_clast (sese region, loop_p context_loop, struct clast_stmt *stmt,
bb_pbb_mapping, params_index);
else if (CLAST_STMT_IS_A (stmt, stmt_for))
- next_e = translate_clast_for (region, context_loop,
- (struct clast_for *) stmt, next_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+ next_e = translate_clast_for (region,
+ (struct clast_for *) stmt, next_e, rename_map,
+ newivs, newivs_index, bb_pbb_mapping,
+ params_index);
else if (CLAST_STMT_IS_A (stmt, stmt_guard))
- next_e = translate_clast_guard (region, context_loop,
- (struct clast_guard *) stmt, next_e,
+ next_e = translate_clast_guard (region, (struct clast_guard *) stmt, next_e,
rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+ bb_pbb_mapping, params_index);
else if (CLAST_STMT_IS_A (stmt, stmt_block))
- next_e = translate_clast (region, context_loop,
- ((struct clast_block *) stmt)->body,
+ next_e = translate_clast (region, ((struct clast_block *) stmt)->body,
next_e, rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+ bb_pbb_mapping, params_index);
else
gcc_unreachable();
recompute_all_dominators ();
graphite_verify ();
- return translate_clast (region, context_loop, stmt->next, next_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+ return translate_clast (region, stmt->next, next_e, rename_map, newivs,
+ newivs_index, bb_pbb_mapping, params_index);
}
/* Returns the first cloog name used in EXPR. */
@@ -1336,7 +1331,6 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
{
edge new_scop_exit_edge = NULL;
VEC (tree, heap) *newivs = VEC_alloc (tree, heap, 10);
- loop_p context_loop;
sese region = SCOP_REGION (scop);
ifsese if_region = NULL;
htab_t rename_map, newivs_index, params_index;
@@ -1364,7 +1358,6 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
recompute_all_dominators ();
graphite_verify ();
- context_loop = SESE_ENTRY (region)->src->loop_father;
compute_cloog_iv_types (pc.stmt);
rename_map = htab_create (10, rename_map_elt_info, eq_rename_map_elts, free);
newivs_index = htab_create (10, clast_name_index_elt_info,
@@ -1374,10 +1367,10 @@ gloog (scop_p scop, htab_t bb_pbb_mapping)
create_params_index (params_index, pc.prog);
- new_scop_exit_edge = translate_clast (region, context_loop, pc.stmt,
+ new_scop_exit_edge = translate_clast (region, pc.stmt,
if_region->true_region->entry,
rename_map, &newivs, newivs_index,
- bb_pbb_mapping, 1, params_index);
+ bb_pbb_mapping, params_index);
graphite_verify ();
sese_adjust_liveout_phis (region, rename_map,
if_region->region->exit->src,
--
1.6.5.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 2/7] split translate_clast into single methods
2009-11-30 22:11 [PATCH 0/7] Fix SPEC2006 dealII with graphite enabled - committed Tobias Grosser
` (3 preceding siblings ...)
2009-11-30 22:11 ` [PATCH 4/7] Remove context_loop and level from translate_clast_* methods Tobias Grosser
@ 2009-11-30 22:11 ` Tobias Grosser
2009-11-30 22:11 ` [PATCH 3/7] Simplify translate_clast_* methods Tobias Grosser
2009-11-30 22:19 ` [PATCH 6/7] Fix comments Tobias Grosser
6 siblings, 0 replies; 10+ messages in thread
From: Tobias Grosser @ 2009-11-30 22:11 UTC (permalink / raw)
To: gcc-patches
From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>
2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
* graphite-clast-to-gimple.c (translate_clast_user,
translate_clast_for, translate_clast_guard): Split out of
translate_clast.
---
gcc/ChangeLog.graphite | 6 +
gcc/graphite-clast-to-gimple.c | 245 +++++++++++++++++++++++++---------------
2 files changed, 158 insertions(+), 93 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 3f5a431..7de3ce2 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,9 @@
+2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-clast-to-gimple.c (translate_clast_user,
+ translate_clast_for, translate_clast_guard): Split out of
+ translate_clast.
+
2009-11-21 Tobias Grosser <grosser@fim.uni-passau.de>
* graphite-clast-to-gimple.c (clast_name_index, new_clast_name_index,
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index f4a7840..c2fda8b 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -718,20 +718,157 @@ dependency_in_loop_p (loop_p loop, htab_t bb_pbb_mapping, int level)
return false;
}
-/* Translates a CLAST statement STMT to GCC representation in the
- context of a SESE.
+static edge
+translate_clast (sese, loop_p, struct clast_stmt *, edge, htab_t,
+ VEC (tree, heap) **, htab_t, htab_t, int, htab_t);
+/* Translates a clast user statement STMT to gimple.
+
+ - REGION is the sese region we used to generate the scop.
- NEXT_E is the edge where new generated code should be attached.
- CONTEXT_LOOP is the loop in which the generated code will be placed
- RENAME_MAP contains a set of tuples of new names associated to
the original variables names.
- BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping.
-*/
+ - PARAMS_INDEX connects the cloog parameters with the gimple parameters in
+ the sese region. */
+static edge
+translate_clast_user (sese region, struct loop *context_loop,
+ struct clast_stmt *stmt, edge next_e,
+ htab_t rename_map, VEC (tree, heap) **newivs,
+ htab_t newivs_index, htab_t bb_pbb_mapping, int level,
+ htab_t params_index)
+{
+ gimple_bb_p gbb;
+ basic_block new_bb;
+ CloogStatement *cs = ((struct clast_user_stmt*) stmt)->statement;
+ poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
+ gbb = PBB_BLACK_BOX (pbb);
+
+ if (GBB_BB (gbb) == ENTRY_BLOCK_PTR)
+ return next_e;
+
+ build_iv_mapping (rename_map, region, *newivs, newivs_index,
+ (struct clast_user_stmt*) stmt, params_index);
+ next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb), region,
+ next_e, rename_map);
+ new_bb = next_e->src;
+ mark_bb_with_pbb (pbb, new_bb, bb_pbb_mapping);
+ recompute_all_dominators ();
+ update_ssa (TODO_update_ssa);
+ graphite_verify ();
+ return translate_clast (region, context_loop, stmt->next, next_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping, level, params_index);
+}
+
+/* Translates a clast for statement STMT to gimple.
+
+ - REGION is the sese region we used to generate the scop.
+ - NEXT_E is the edge where new generated code should be attached.
+ - CONTEXT_LOOP is the loop in which the generated code will be placed
+ - RENAME_MAP contains a set of tuples of new names associated to
+ the original variables names.
+ - BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping.
+ - PARAMS_INDEX connects the cloog parameters with the gimple parameters in
+ the sese region. */
+static edge
+translate_clast_for (sese region, loop_p context_loop, struct clast_stmt *stmt,
+ edge next_e, htab_t rename_map, VEC (tree, heap) **newivs,
+ htab_t newivs_index, htab_t bb_pbb_mapping, int level,
+ htab_t params_index)
+{
+ struct clast_for *stmtfor = (struct clast_for *)stmt;
+ struct loop *loop
+ = graphite_create_new_loop (region, next_e, stmtfor,
+ context_loop, newivs, newivs_index,
+ params_index);
+ edge last_e = single_exit (loop);
+ edge to_body = single_succ_edge (loop->header);
+ basic_block after = to_body->dest;
+
+ /* Create a basic block for loop close phi nodes. */
+ last_e = single_succ_edge (split_edge (last_e));
+
+ /* Translate the body of the loop. */
+ next_e = translate_clast
+ (region, loop, ((struct clast_for *) stmt)->body,
+ single_succ_edge (loop->header), rename_map, newivs,
+ newivs_index, bb_pbb_mapping, level + 1, params_index);
+ redirect_edge_succ_nodup (next_e, after);
+ set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src);
+
+ /* Remove from rename_map all the tuples containing variables
+ defined in loop's body. */
+ insert_loop_close_phis (rename_map, loop);
+
+ if (flag_loop_parallelize_all
+ && !dependency_in_loop_p (loop, bb_pbb_mapping,
+ get_scattering_level (level)))
+ loop->can_be_parallel = true;
+
+ recompute_all_dominators ();
+ graphite_verify ();
+ return translate_clast (region, context_loop, stmt->next, last_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping, level, params_index);
+}
+
+/* Translates a clast guard statement STMT to gimple.
+
+ - REGION is the sese region we used to generate the scop.
+ - NEXT_E is the edge where new generated code should be attached.
+ - CONTEXT_LOOP is the loop in which the generated code will be placed
+ - RENAME_MAP contains a set of tuples of new names associated to
+ the original variables names.
+ - BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping.
+ - PARAMS_INDEX connects the cloog parameters with the gimple parameters in
+ the sese region. */
+static edge
+translate_clast_guard (sese region, loop_p context_loop,
+ struct clast_stmt *stmt, edge next_e, htab_t rename_map,
+ VEC (tree, heap) **newivs, htab_t newivs_index,
+ htab_t bb_pbb_mapping, int level, htab_t params_index)
+{
+ edge last_e = graphite_create_new_guard (region, next_e,
+ ((struct clast_guard *) stmt),
+ *newivs, newivs_index,
+ params_index);
+ edge true_e = get_true_edge_from_guard_bb (next_e->dest);
+ edge false_e = get_false_edge_from_guard_bb (next_e->dest);
+ edge exit_true_e = single_succ_edge (true_e->dest);
+ edge exit_false_e = single_succ_edge (false_e->dest);
+ htab_t before_guard = htab_create (10, rename_map_elt_info,
+ eq_rename_map_elts, free);
+
+ htab_traverse (rename_map, copy_renames, before_guard);
+ next_e = translate_clast (region, context_loop,
+ ((struct clast_guard *) stmt)->then,
+ true_e, rename_map, newivs, newivs_index,
+ bb_pbb_mapping, level, params_index);
+ insert_guard_phis (last_e->src, exit_true_e, exit_false_e,
+ before_guard, rename_map);
+
+ htab_delete (before_guard);
+ recompute_all_dominators ();
+ graphite_verify ();
+
+ return translate_clast (region, context_loop, stmt->next, last_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping, level, params_index);
+}
+
+/* Translates a CLAST statement STMT to GCC representation in the
+ context of a SESE.
+ - NEXT_E is the edge where new generated code should be attached.
+ - CONTEXT_LOOP is the loop in which the generated code will be placed
+ - RENAME_MAP contains a set of tuples of new names associated to
+ the original variables names.
+ - BB_PBB_MAPPING is is a basic_block and it's related poly_bb_p mapping. */
static edge
-translate_clast (sese region, struct loop *context_loop,
- struct clast_stmt *stmt, edge next_e,
- htab_t rename_map, VEC (tree, heap) **newivs,
+translate_clast (sese region, loop_p context_loop, struct clast_stmt *stmt,
+ edge next_e, htab_t rename_map, VEC (tree, heap) **newivs,
htab_t newivs_index, htab_t bb_pbb_mapping, int level,
htab_t params_index)
{
@@ -744,97 +881,19 @@ translate_clast (sese region, struct loop *context_loop,
bb_pbb_mapping, level, params_index);
if (CLAST_STMT_IS_A (stmt, stmt_user))
- {
- gimple_bb_p gbb;
- basic_block new_bb;
- CloogStatement *cs = ((struct clast_user_stmt *) stmt)->statement;
- poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
- gbb = PBB_BLACK_BOX (pbb);
-
- if (GBB_BB (gbb) == ENTRY_BLOCK_PTR)
- return next_e;
-
- build_iv_mapping (rename_map, region, *newivs, newivs_index,
- (struct clast_user_stmt *) stmt, params_index);
- next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb), region,
- next_e, rename_map);
- new_bb = next_e->src;
- mark_bb_with_pbb (pbb, new_bb, bb_pbb_mapping);
- recompute_all_dominators ();
- update_ssa (TODO_update_ssa);
- graphite_verify ();
- return translate_clast (region, context_loop, stmt->next, next_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
- }
+ return translate_clast_user (region, context_loop, stmt, next_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping, level, params_index);
if (CLAST_STMT_IS_A (stmt, stmt_for))
- {
- struct clast_for *stmtfor = (struct clast_for *)stmt;
- struct loop *loop
- = graphite_create_new_loop (region, next_e, stmtfor,
- context_loop, newivs, newivs_index,
- params_index);
- edge last_e = single_exit (loop);
- edge to_body = single_succ_edge (loop->header);
- basic_block after = to_body->dest;
-
- /* Create a basic block for loop close phi nodes. */
- last_e = single_succ_edge (split_edge (last_e));
-
- /* Translate the body of the loop. */
- next_e = translate_clast
- (region, loop, ((struct clast_for *) stmt)->body,
- single_succ_edge (loop->header), rename_map, newivs,
- newivs_index, bb_pbb_mapping, level + 1, params_index);
- redirect_edge_succ_nodup (next_e, after);
- set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src);
-
- /* Remove from rename_map all the tuples containing variables
- defined in loop's body. */
- insert_loop_close_phis (rename_map, loop);
-
- if (flag_loop_parallelize_all
- && !dependency_in_loop_p (loop, bb_pbb_mapping,
- get_scattering_level (level)))
- loop->can_be_parallel = true;
-
- recompute_all_dominators ();
- graphite_verify ();
- return translate_clast (region, context_loop, stmt->next, last_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
- }
-
- if (CLAST_STMT_IS_A (stmt, stmt_guard))
- {
- edge last_e = graphite_create_new_guard (region, next_e,
- ((struct clast_guard *) stmt),
- *newivs, newivs_index,
- params_index);
- edge true_e = get_true_edge_from_guard_bb (next_e->dest);
- edge false_e = get_false_edge_from_guard_bb (next_e->dest);
- edge exit_true_e = single_succ_edge (true_e->dest);
- edge exit_false_e = single_succ_edge (false_e->dest);
- htab_t before_guard = htab_create (10, rename_map_elt_info,
- eq_rename_map_elts, free);
-
- htab_traverse (rename_map, copy_renames, before_guard);
- next_e = translate_clast (region, context_loop,
- ((struct clast_guard *) stmt)->then,
- true_e, rename_map, newivs, newivs_index,
+ return translate_clast_for (region, context_loop, stmt, next_e,
+ rename_map, newivs, newivs_index,
bb_pbb_mapping, level, params_index);
- insert_guard_phis (last_e->src, exit_true_e, exit_false_e,
- before_guard, rename_map);
-
- htab_delete (before_guard);
- recompute_all_dominators ();
- graphite_verify ();
- return translate_clast (region, context_loop, stmt->next, last_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
- }
+ if (CLAST_STMT_IS_A (stmt, stmt_guard))
+ return translate_clast_guard (region, context_loop, stmt, next_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping, level, params_index);
if (CLAST_STMT_IS_A (stmt, stmt_block))
{
--
1.6.5.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 3/7] Simplify translate_clast_* methods
2009-11-30 22:11 [PATCH 0/7] Fix SPEC2006 dealII with graphite enabled - committed Tobias Grosser
` (4 preceding siblings ...)
2009-11-30 22:11 ` [PATCH 2/7] split translate_clast into single methods Tobias Grosser
@ 2009-11-30 22:11 ` Tobias Grosser
2009-11-30 22:19 ` [PATCH 6/7] Fix comments Tobias Grosser
6 siblings, 0 replies; 10+ messages in thread
From: Tobias Grosser @ 2009-11-30 22:11 UTC (permalink / raw)
To: gcc-patches
From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>
2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
* graphite-clast-to-gimple.c (translate_clast_user,
translate_clast_for, translate_clast_guard): Simplify and move common
elements to translate_clast().
(translate_clast): Simplify and get common elements.
---
gcc/ChangeLog.graphite | 7 ++
gcc/graphite-clast-to-gimple.c | 126 +++++++++++++++++----------------------
2 files changed, 62 insertions(+), 71 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 7de3ce2..49c11b2 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,6 +1,13 @@
2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
* graphite-clast-to-gimple.c (translate_clast_user,
+ translate_clast_for, translate_clast_guard): Simplify and move common
+ elements to translate_clast().
+ (translate_clast): Simplify and get common elements.
+
+2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-clast-to-gimple.c (translate_clast_user,
translate_clast_for, translate_clast_guard): Split out of
translate_clast.
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index c2fda8b..f708c76 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -733,33 +733,27 @@ translate_clast (sese, loop_p, struct clast_stmt *, edge, htab_t,
- PARAMS_INDEX connects the cloog parameters with the gimple parameters in
the sese region. */
static edge
-translate_clast_user (sese region, struct loop *context_loop,
- struct clast_stmt *stmt, edge next_e,
+translate_clast_user (sese region, struct clast_user_stmt *stmt, edge next_e,
htab_t rename_map, VEC (tree, heap) **newivs,
- htab_t newivs_index, htab_t bb_pbb_mapping, int level,
+ htab_t newivs_index, htab_t bb_pbb_mapping,
htab_t params_index)
{
gimple_bb_p gbb;
basic_block new_bb;
- CloogStatement *cs = ((struct clast_user_stmt*) stmt)->statement;
- poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (cs);
+ poly_bb_p pbb = (poly_bb_p) cloog_statement_usr (stmt->statement);
gbb = PBB_BLACK_BOX (pbb);
if (GBB_BB (gbb) == ENTRY_BLOCK_PTR)
return next_e;
- build_iv_mapping (rename_map, region, *newivs, newivs_index,
- (struct clast_user_stmt*) stmt, params_index);
+ build_iv_mapping (rename_map, region, *newivs, newivs_index, stmt,
+ params_index);
next_e = copy_bb_and_scalar_dependences (GBB_BB (gbb), region,
next_e, rename_map);
new_bb = next_e->src;
mark_bb_with_pbb (pbb, new_bb, bb_pbb_mapping);
- recompute_all_dominators ();
update_ssa (TODO_update_ssa);
- graphite_verify ();
- return translate_clast (region, context_loop, stmt->next, next_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+ return next_e;
}
/* Translates a clast for statement STMT to gimple.
@@ -773,16 +767,14 @@ translate_clast_user (sese region, struct loop *context_loop,
- PARAMS_INDEX connects the cloog parameters with the gimple parameters in
the sese region. */
static edge
-translate_clast_for (sese region, loop_p context_loop, struct clast_stmt *stmt,
+translate_clast_for (sese region, loop_p context_loop, struct clast_for *stmt,
edge next_e, htab_t rename_map, VEC (tree, heap) **newivs,
htab_t newivs_index, htab_t bb_pbb_mapping, int level,
htab_t params_index)
{
- struct clast_for *stmtfor = (struct clast_for *)stmt;
- struct loop *loop
- = graphite_create_new_loop (region, next_e, stmtfor,
- context_loop, newivs, newivs_index,
- params_index);
+ struct loop *loop = graphite_create_new_loop (region, next_e, stmt,
+ context_loop, newivs,
+ newivs_index, params_index);
edge last_e = single_exit (loop);
edge to_body = single_succ_edge (loop->header);
basic_block after = to_body->dest;
@@ -791,10 +783,9 @@ translate_clast_for (sese region, loop_p context_loop, struct clast_stmt *stmt,
last_e = single_succ_edge (split_edge (last_e));
/* Translate the body of the loop. */
- next_e = translate_clast
- (region, loop, ((struct clast_for *) stmt)->body,
- single_succ_edge (loop->header), rename_map, newivs,
- newivs_index, bb_pbb_mapping, level + 1, params_index);
+ next_e = translate_clast (region, loop, stmt->body, to_body, rename_map,
+ newivs, newivs_index, bb_pbb_mapping, level + 1,
+ params_index);
redirect_edge_succ_nodup (next_e, after);
set_immediate_dominator (CDI_DOMINATORS, next_e->dest, next_e->src);
@@ -807,11 +798,7 @@ translate_clast_for (sese region, loop_p context_loop, struct clast_stmt *stmt,
get_scattering_level (level)))
loop->can_be_parallel = true;
- recompute_all_dominators ();
- graphite_verify ();
- return translate_clast (region, context_loop, stmt->next, last_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+ return last_e;
}
/* Translates a clast guard statement STMT to gimple.
@@ -826,36 +813,33 @@ translate_clast_for (sese region, loop_p context_loop, struct clast_stmt *stmt,
the sese region. */
static edge
translate_clast_guard (sese region, loop_p context_loop,
- struct clast_stmt *stmt, edge next_e, htab_t rename_map,
- VEC (tree, heap) **newivs, htab_t newivs_index,
- htab_t bb_pbb_mapping, int level, htab_t params_index)
+ struct clast_guard *stmt, edge next_e,
+ htab_t rename_map, VEC (tree, heap) **newivs,
+ htab_t newivs_index, htab_t bb_pbb_mapping, int level,
+ htab_t params_index)
{
- edge last_e = graphite_create_new_guard (region, next_e,
- ((struct clast_guard *) stmt),
- *newivs, newivs_index,
- params_index);
+ edge last_e = graphite_create_new_guard (region, next_e, stmt, *newivs,
+ newivs_index, params_index);
+
edge true_e = get_true_edge_from_guard_bb (next_e->dest);
edge false_e = get_false_edge_from_guard_bb (next_e->dest);
edge exit_true_e = single_succ_edge (true_e->dest);
edge exit_false_e = single_succ_edge (false_e->dest);
+
htab_t before_guard = htab_create (10, rename_map_elt_info,
eq_rename_map_elts, free);
-
htab_traverse (rename_map, copy_renames, before_guard);
- next_e = translate_clast (region, context_loop,
- ((struct clast_guard *) stmt)->then,
- true_e, rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+
+ next_e = translate_clast (region, context_loop, stmt->then, true_e,
+ rename_map, newivs, newivs_index, bb_pbb_mapping,
+ level, params_index);
+
insert_guard_phis (last_e->src, exit_true_e, exit_false_e,
before_guard, rename_map);
htab_delete (before_guard);
- recompute_all_dominators ();
- graphite_verify ();
- return translate_clast (region, context_loop, stmt->next, last_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+ return last_e;
}
/* Translates a CLAST statement STMT to GCC representation in the
@@ -876,39 +860,39 @@ translate_clast (sese region, loop_p context_loop, struct clast_stmt *stmt,
return next_e;
if (CLAST_STMT_IS_A (stmt, stmt_root))
- return translate_clast (region, context_loop, stmt->next, next_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+ ; /* Do nothing. */
- if (CLAST_STMT_IS_A (stmt, stmt_user))
- return translate_clast_user (region, context_loop, stmt, next_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
-
- if (CLAST_STMT_IS_A (stmt, stmt_for))
- return translate_clast_for (region, context_loop, stmt, next_e,
- rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
+ else if (CLAST_STMT_IS_A (stmt, stmt_user))
+ next_e = translate_clast_user (region, (struct clast_user_stmt *) stmt,
+ next_e, rename_map, newivs, newivs_index,
+ bb_pbb_mapping, params_index);
- if (CLAST_STMT_IS_A (stmt, stmt_guard))
- return translate_clast_guard (region, context_loop, stmt, next_e,
+ else if (CLAST_STMT_IS_A (stmt, stmt_for))
+ next_e = translate_clast_for (region, context_loop,
+ (struct clast_for *) stmt, next_e,
rename_map, newivs, newivs_index,
bb_pbb_mapping, level, params_index);
- if (CLAST_STMT_IS_A (stmt, stmt_block))
- {
- next_e = translate_clast (region, context_loop,
- ((struct clast_block *) stmt)->body,
- next_e, rename_map, newivs, newivs_index,
- bb_pbb_mapping, level, params_index);
- recompute_all_dominators ();
- graphite_verify ();
- return translate_clast (region, context_loop, stmt->next, next_e,
- rename_map, newivs, newivs_index,
+ else if (CLAST_STMT_IS_A (stmt, stmt_guard))
+ next_e = translate_clast_guard (region, context_loop,
+ (struct clast_guard *) stmt, next_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping, level, params_index);
+
+ else if (CLAST_STMT_IS_A (stmt, stmt_block))
+ next_e = translate_clast (region, context_loop,
+ ((struct clast_block *) stmt)->body,
+ next_e, rename_map, newivs, newivs_index,
bb_pbb_mapping, level, params_index);
- }
+ else
+ gcc_unreachable();
- gcc_unreachable ();
+ recompute_all_dominators ();
+ graphite_verify ();
+
+ return translate_clast (region, context_loop, stmt->next, next_e,
+ rename_map, newivs, newivs_index,
+ bb_pbb_mapping, level, params_index);
}
/* Returns the first cloog name used in EXPR. */
--
1.6.5.3
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH 6/7] Fix comments.
2009-11-30 22:11 [PATCH 0/7] Fix SPEC2006 dealII with graphite enabled - committed Tobias Grosser
` (5 preceding siblings ...)
2009-11-30 22:11 ` [PATCH 3/7] Simplify translate_clast_* methods Tobias Grosser
@ 2009-11-30 22:19 ` Tobias Grosser
6 siblings, 0 replies; 10+ messages in thread
From: Tobias Grosser @ 2009-11-30 22:19 UTC (permalink / raw)
To: gcc-patches
From: grosser <grosser@138bc75d-0d04-0410-961f-82ee72b054a4>
2009-11-24 Tobias Grosser <grosser@fim.uni-passau.de>
* graphite-clast-to-gimple.c (try_mark_loop_parallel,
graphite_create_new_loop_guard, translate_clast_for): Fix comments.
---
gcc/ChangeLog.graphite | 5 +++++
gcc/graphite-clast-to-gimple.c | 18 +++++++++---------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 863b0be..e9e9806 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,8 @@
+2009-11-24 Tobias Grosser <grosser@fim.uni-passau.de>
+
+ * graphite-clast-to-gimple.c (try_mark_loop_parallel,
+ graphite_create_new_loop_guard, translate_clast_for): Fix comments.
+
2009-11-23 Tobias Grosser <grosser@fim.uni-passau.de>
PR middle-end/42130
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 3795f6f..93138b6 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -754,8 +754,8 @@ translate_clast_user (sese region, struct clast_user_stmt *stmt, edge next_e,
}
/* Mark a loop parallel, if the graphite dependency check cannot find any
- * dependencies. This triggers parallel code generation in the autopar pass.
- * */
+ dependencies. This triggers parallel code generation in the autopar pass.
+ */
static void
try_mark_loop_parallel (sese region, loop_p loop, htab_t bb_pbb_mapping)
{
@@ -772,7 +772,7 @@ static tree gcc_type_for_iv_of_clast_loop (struct clast_for *);
/* Creates a new if region protecting the loop to be executed, if the execution
- * count is zero (lb > ub). */
+ count is zero (lb > ub). */
static edge
graphite_create_new_loop_guard (sese region, edge entry_edge,
struct clast_for *stmt,
@@ -788,10 +788,10 @@ graphite_create_new_loop_guard (sese region, edge entry_edge,
newivs_index, params_index);
/* XXX: Adding +1 and using LT_EXPR helps with loop latches that have a
- * loop iteration count of "PARAMETER - 1". For PARAMETER == 0 this becomes
- * 2^{32|64}, and the condition lb <= ub is true, even if we do not want this.
- * However lb < ub + 1 is false, as expected.
- * There might be a problem with cases where ub is 2^32. */
+ loop iteration count of "PARAMETER - 1". For PARAMETER == 0 this becomes
+ 2^{32|64}, and the condition lb <= ub is true, even if we do not want this.
+ However lb < ub + 1 is false, as expected.
+ There might be a problem with cases where ub is 2^32. */
tree one;
Value gmp_one;
value_init (gmp_one);
@@ -842,8 +842,8 @@ translate_clast_for_loop (sese region, struct clast_for *stmt, edge next_e,
}
/* Translates a clast for statement STMT to gimple. First a guard is created
- * protecting the loop, if it is executed zero times. In this guard we create
- * the real loop structure.
+ protecting the loop, if it is executed zero times. In this guard we create
+ the real loop structure.
- REGION is the sese region we used to generate the scop.
- NEXT_E is the edge where new generated code should be attached.
--
1.6.5.3
^ permalink raw reply [flat|nested] 10+ messages in thread