* [patch][graphite] Remove sese_adjust_liveout_phis
@ 2010-06-12 8:17 Sebastian Pop
2010-06-12 12:03 ` Sebastian Pop
2010-06-14 18:20 ` Sebastian Pop
0 siblings, 2 replies; 5+ messages in thread
From: Sebastian Pop @ 2010-06-12 8:17 UTC (permalink / raw)
To: GCC Patches, gcc-graphite
[-- Attachment #1: Type: text/plain, Size: 717 bytes --]
Hi,
with the attached patches we no longer need to use the rename_map to
substitute the arguments of the phi nodes created after the code
generated by Graphite. I committed these patches to the graphite
branch, and I will commit them to trunk once they pass the usual
graphite branch tests.
The aim is to replace the rename_map with the map that CLooG exposes
for each user statement: associating to a loop level an expression.
The expand_* functions will be replaced by the code generation from a
chrec that is obtained from the original scev by chrec_applying the
loop level -> expression map on each varying loop. This will then
allow us to remove the call to the IV canonicalization from Graphite.
Sebastian
[-- Attachment #2: 0001-Launch-dotty-in-background.patch --]
[-- Type: text/x-diff, Size: 2068 bytes --]
From e747edcf6bd61fe4eae201b70181cba5ce43edbf Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Fri, 11 Jun 2010 18:42:21 -0500
Subject: [PATCH 1/4] Launch dotty in background.
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-dependences.c (dot_deps): Make system call to dotty run
in background.
(dot_deps_stmt): Same.
* graphite-poly.c (dot_lst): Same.
---
gcc/ChangeLog.graphite | 7 +++++++
gcc/graphite-dependences.c | 4 ++--
gcc/graphite-poly.c | 2 +-
3 files changed, 10 insertions(+), 3 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 6df816b..72bb7f5 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,10 @@
+2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+
+ * graphite-dependences.c (dot_deps): Make system call to dotty run
+ in background.
+ (dot_deps_stmt): Same.
+ * graphite-poly.c (dot_lst): Same.
+
2010-06-11 Sebastian Pop <sebastian.pop@amd.com>
* graphite-clast-to-gimple.c (gcc_type_for_interval): Do not pass
diff --git a/gcc/graphite-dependences.c b/gcc/graphite-dependences.c
index 41824e4..91743f1 100644
--- a/gcc/graphite-dependences.c
+++ b/gcc/graphite-dependences.c
@@ -963,7 +963,7 @@ dot_deps (scop_p scop)
dot_deps_1 (stream, scop);
fclose (stream);
- system ("dotty /tmp/scopdeps.dot");
+ system ("dotty /tmp/scopdeps.dot &");
#else
dot_deps_1 (stderr, scop);
#endif
@@ -983,7 +983,7 @@ dot_deps_stmt (scop_p scop)
dot_deps_stmt_1 (stream, scop);
fclose (stream);
- system ("dotty /tmp/scopdeps.dot");
+ system ("dotty /tmp/scopdeps.dot &");
#else
dot_deps_stmt_1 (stderr, scop);
#endif
diff --git a/gcc/graphite-poly.c b/gcc/graphite-poly.c
index 24a47f0..28430ed 100644
--- a/gcc/graphite-poly.c
+++ b/gcc/graphite-poly.c
@@ -1320,7 +1320,7 @@ dot_lst (lst_p lst)
fputs ("}\n\n", stream);
fclose (stream);
- system ("dotty /tmp/lst.dot");
+ system ("dotty /tmp/lst.dot &");
#else
fputs ("digraph all {\n", stderr);
dot_lst_1 (stderr, lst);
--
1.7.0.4
[-- Attachment #3: 0002-Detect-commutative-reductions-in-all-the-scops-befor.patch --]
[-- Type: text/x-diff, Size: 5719 bytes --]
From 9c6db20feae3d4cb96966f0877c19d96ff4c5c66 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Fri, 11 Jun 2010 19:37:07 -0500
Subject: [PATCH 2/4] Detect commutative reductions in all the scops before rewriting out of SSA all the other scalar dependences.
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (build_scop_bbs): Not static anymore.
(rewrite_reductions_out_of_ssa): Same.
(rewrite_commutative_reductions_out_of_ssa): Same.
(build_poly_scop): Do not call these functions.
* graphite-sese-to-poly.h (build_poly_scop): Declared.
(rewrite_reductions_out_of_ssa): Declared.
(rewrite_commutative_reductions_out_of_ssa): Declared.
* graphite.c (graphite_transform_loops): Call on every scop
rewrite_commutative_reductions_out_of_ssa before calling
rewrite_reductions_out_of_ssa and build_scop_bbs.
---
gcc/ChangeLog.graphite | 13 +++++++++++++
gcc/graphite-sese-to-poly.c | 16 +++++-----------
gcc/graphite-sese-to-poly.h | 3 +++
gcc/graphite.c | 14 ++++++++++++++
4 files changed, 35 insertions(+), 11 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 72bb7f5..a87c69d 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,18 @@
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+ * graphite-sese-to-poly.c (build_scop_bbs): Not static anymore.
+ (rewrite_reductions_out_of_ssa): Same.
+ (rewrite_commutative_reductions_out_of_ssa): Same.
+ (build_poly_scop): Do not call these functions.
+ * graphite-sese-to-poly.h (build_poly_scop): Declared.
+ (rewrite_reductions_out_of_ssa): Declared.
+ (rewrite_commutative_reductions_out_of_ssa): Declared.
+ * graphite.c (graphite_transform_loops): Call on every scop
+ rewrite_commutative_reductions_out_of_ssa before calling
+ rewrite_reductions_out_of_ssa and build_scop_bbs.
+
+2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+
* graphite-dependences.c (dot_deps): Make system call to dotty run
in background.
(dot_deps_stmt): Same.
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 41e2c9f..66c0282 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -462,7 +462,7 @@ build_scop_bbs_1 (scop_p scop, sbitmap visited, basic_block bb, sbitmap reductio
/* Gather the basic blocks belonging to the SCOP. */
-static void
+void
build_scop_bbs (scop_p scop, sbitmap reductions)
{
sbitmap visited = sbitmap_alloc (last_basic_block);
@@ -2398,7 +2398,7 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
/* Rewrite out of SSA all the reduction phi nodes of SCOP. */
-static void
+void
rewrite_reductions_out_of_ssa (scop_p scop)
{
basic_block bb;
@@ -2577,7 +2577,7 @@ detect_commutative_reduction_arg (tree lhs, gimple stmt, tree arg,
}
/* Detect commutative and associative scalar reductions starting at
- the STMT. Return the phi node of the reduction cycle, or NULL. */
+ STMT. Return the phi node of the reduction cycle, or NULL. */
static gimple
detect_commutative_reduction_assign (gimple stmt, VEC (gimple, heap) **in,
@@ -2665,7 +2665,7 @@ initial_value_for_loop_phi (gimple phi)
}
/* Detect commutative and associative scalar reductions starting at
- the loop closed phi node CLOSE_PHI. Return the phi node of the
+ the loop closed phi node STMT. Return the phi node of the
reduction cycle, or NULL. */
static gimple
@@ -2873,7 +2873,7 @@ rewrite_commutative_reductions_out_of_ssa_loop (loop_p loop,
/* Rewrites all the commutative reductions from SCOP out of SSA. */
-static void
+void
rewrite_commutative_reductions_out_of_ssa (sese region, sbitmap reductions)
{
loop_iterator li;
@@ -2972,14 +2972,8 @@ void
build_poly_scop (scop_p scop)
{
sese region = SCOP_REGION (scop);
- sbitmap reductions = sbitmap_alloc (last_basic_block * 2);
graphite_dim_t max_dim;
- sbitmap_zero (reductions);
- rewrite_commutative_reductions_out_of_ssa (region, reductions);
- rewrite_reductions_out_of_ssa (scop);
- build_scop_bbs (scop, reductions);
- sbitmap_free (reductions);
/* FIXME: This restriction is needed to avoid a problem in CLooG.
Once CLooG is fixed, remove this guard. Anyways, it makes no
diff --git a/gcc/graphite-sese-to-poly.h b/gcc/graphite-sese-to-poly.h
index ccf36dd..2e0cc08 100644
--- a/gcc/graphite-sese-to-poly.h
+++ b/gcc/graphite-sese-to-poly.h
@@ -30,5 +30,8 @@ struct base_alias_pair
void build_poly_scop (scop_p);
void check_poly_representation (scop_p);
+void rewrite_commutative_reductions_out_of_ssa (sese, sbitmap);
+void rewrite_reductions_out_of_ssa (scop_p);
+void build_scop_bbs (scop_p, sbitmap);
#endif
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 347ebc8..5f28aeb 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -254,6 +254,7 @@ graphite_transform_loops (void)
bool need_cfg_cleanup_p = false;
VEC (scop_p, heap) *scops = NULL;
htab_t bb_pbb_mapping;
+ sbitmap reductions;
if (!graphite_initialize ())
return;
@@ -267,6 +268,19 @@ graphite_transform_loops (void)
}
bb_pbb_mapping = htab_create (10, bb_pbb_map_hash, eq_bb_pbb_map, free);
+ reductions = sbitmap_alloc (last_basic_block * 2);
+ sbitmap_zero (reductions);
+
+ for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ rewrite_commutative_reductions_out_of_ssa (SCOP_REGION (scop), reductions);
+
+ for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
+ {
+ rewrite_reductions_out_of_ssa (scop);
+ build_scop_bbs (scop, reductions);
+ }
+
+ sbitmap_free (reductions);
for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
if (dbg_cnt (graphite_scop))
--
1.7.0.4
[-- Attachment #4: 0003-Remove-insert_copyout-and-insert_copyin.patch --]
[-- Type: text/x-diff, Size: 6148 bytes --]
From d36ba67360a736e061133c52e84aeaef7b1347eb Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Fri, 11 Jun 2010 19:43:13 -0500
Subject: [PATCH 3/4] Remove insert_copyout and insert_copyin.
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-sese-to-poly.c (insert_out_of_ssa_copy): Pass an extra
argument for the place after which to insert the out of SSA copy.
(rewrite_close_phi_out_of_ssa): Update calls to insert_out_of_ssa_copy.
(rewrite_phi_out_of_ssa): Same.
(rewrite_cross_bb_scalar_deps): Same.
(insert_copyout): Removed.
(insert_copyin): Removed.
(translate_scalar_reduction_to_array): Call insert_out_of_ssa_copy and
insert_out_of_ssa_copy_on_edge instead of insert_copyout and
insert_copyin.
---
gcc/ChangeLog.graphite | 13 ++++++++++
gcc/graphite-sese-to-poly.c | 53 ++++++++++++------------------------------
2 files changed, 28 insertions(+), 38 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index a87c69d..888a77d 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,18 @@
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+ * graphite-sese-to-poly.c (insert_out_of_ssa_copy): Pass an extra
+ argument for the place after which to insert the out of SSA copy.
+ (rewrite_close_phi_out_of_ssa): Update calls to insert_out_of_ssa_copy.
+ (rewrite_phi_out_of_ssa): Same.
+ (rewrite_cross_bb_scalar_deps): Same.
+ (insert_copyout): Removed.
+ (insert_copyin): Removed.
+ (translate_scalar_reduction_to_array): Call insert_out_of_ssa_copy and
+ insert_out_of_ssa_copy_on_edge instead of insert_copyout and
+ insert_copyin.
+
+2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+
* graphite-sese-to-poly.c (build_scop_bbs): Not static anymore.
(rewrite_reductions_out_of_ssa): Same.
(rewrite_commutative_reductions_out_of_ssa): Same.
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 66c0282..7bb7bb8 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2116,10 +2116,10 @@ gsi_for_phi_node (gimple stmt)
return psi;
}
-/* Insert the assignment "RES := VAR" just after the definition of VAR. */
+/* Insert the assignment "RES := VAR" just after AFTER_STMT. */
static void
-insert_out_of_ssa_copy (tree res, tree var)
+insert_out_of_ssa_copy (tree res, tree var, gimple after_stmt)
{
gimple stmt;
gimple_seq stmts;
@@ -2133,15 +2133,14 @@ insert_out_of_ssa_copy (tree res, tree var)
si = gsi_last (stmts);
gsi_insert_after (&si, stmt, GSI_NEW_STMT);
- stmt = SSA_NAME_DEF_STMT (var);
- if (gimple_code (stmt) == GIMPLE_PHI)
+ if (gimple_code (after_stmt) == GIMPLE_PHI)
{
- gsi = gsi_after_labels (gimple_bb (stmt));
+ gsi = gsi_after_labels (gimple_bb (after_stmt));
gsi_insert_seq_before (&gsi, stmts, GSI_NEW_STMT);
}
else
{
- gsi = gsi_for_stmt (stmt);
+ gsi = gsi_for_stmt (after_stmt);
gsi_insert_seq_after (&gsi, stmts, GSI_NEW_STMT);
}
}
@@ -2217,7 +2216,7 @@ rewrite_close_phi_out_of_ssa (gimple_stmt_iterator *psi)
if (TREE_CODE (arg) == SSA_NAME
&& !SSA_NAME_IS_DEFAULT_DEF (arg))
- insert_out_of_ssa_copy (zero_dim_array, arg);
+ insert_out_of_ssa_copy (zero_dim_array, arg, SSA_NAME_DEF_STMT (arg));
else
insert_out_of_ssa_copy_on_edge (single_pred_edge (gimple_bb (phi)),
zero_dim_array, arg);
@@ -2238,7 +2237,7 @@ rewrite_phi_out_of_ssa (gimple_stmt_iterator *psi)
basic_block bb = gimple_bb (phi);
tree res = gimple_phi_result (phi);
tree var = SSA_NAME_VAR (res);
- tree zero_dim_array = create_zero_dim_array (var, "General_Reduction");
+ tree zero_dim_array = create_zero_dim_array (var, "phi_out_of_ssa");
gimple_stmt_iterator gsi;
gimple stmt;
gimple_seq stmts;
@@ -2294,7 +2293,7 @@ rewrite_phi_out_of_ssa (gimple_stmt_iterator *psi)
gimple_bb (SSA_NAME_DEF_STMT (arg)))
|| flow_bb_inside_loop_p (loop_outer (bb->loop_father),
gimple_bb (SSA_NAME_DEF_STMT (arg)))))
- insert_out_of_ssa_copy (zero_dim_array, arg);
+ insert_out_of_ssa_copy (zero_dim_array, arg, SSA_NAME_DEF_STMT (arg));
else
insert_out_of_ssa_copy_on_edge (gimple_phi_arg_edge (phi, i),
zero_dim_array, arg);
@@ -2388,7 +2387,8 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
{
zero_dim_array = create_zero_dim_array
(SSA_NAME_VAR (def), "Cross_BB_scalar_dependence");
- insert_out_of_ssa_copy (zero_dim_array, def);
+ insert_out_of_ssa_copy (zero_dim_array, def,
+ SSA_NAME_DEF_STMT (def));
gsi_next (gsi);
}
@@ -2727,32 +2727,6 @@ translate_scalar_reduction_to_array_for_stmt (tree red, gimple stmt,
gsi_insert_after (&insert_gsi, assign, GSI_SAME_STMT);
}
-/* Insert the assignment "result (CLOSE_PHI) = RED". */
-
-static void
-insert_copyout (tree red, gimple close_phi)
-{
- tree res = gimple_phi_result (close_phi);
- basic_block bb = gimple_bb (close_phi);
- gimple_stmt_iterator insert_gsi = gsi_after_labels (bb);
- gimple assign = gimple_build_assign (res, red);
-
- gsi_insert_before (&insert_gsi, assign, GSI_SAME_STMT);
-}
-
-/* Insert the assignment "RED = initial_value (LOOP_PHI)". */
-
-static void
-insert_copyin (tree red, gimple loop_phi)
-{
- gimple_seq stmts;
- tree init = initial_value_for_loop_phi (loop_phi);
- tree expr = build2 (MODIFY_EXPR, TREE_TYPE (init), red, init);
-
- force_gimple_operand (expr, &stmts, true, NULL);
- gsi_insert_seq_on_edge (edge_initial_value_for_loop_phi (loop_phi), stmts);
-}
-
/* Removes the PHI node and resets all the debug stmts that are using
the PHI_RESULT. */
@@ -2828,8 +2802,11 @@ translate_scalar_reduction_to_array (VEC (gimple, heap) *in,
if (i == VEC_length (gimple, in) - 1)
{
- insert_copyout (red, close_phi);
- insert_copyin (red, loop_phi);
+ insert_out_of_ssa_copy (gimple_phi_result (close_phi), red,
+ close_phi);
+ insert_out_of_ssa_copy_on_edge
+ (edge_initial_value_for_loop_phi (loop_phi),
+ red, initial_value_for_loop_phi (loop_phi));
}
remove_phi (loop_phi);
--
1.7.0.4
[-- Attachment #5: 0004-Also-rewrite-out-of-SSA-scalar-dependences-going-out.patch --]
[-- Type: text/x-diff, Size: 8911 bytes --]
From e1e77ccc827024af17e5afc9baf5d8f044815052 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Fri, 11 Jun 2010 19:58:39 -0500
Subject: [PATCH 4/4] Also rewrite out of SSA scalar dependences going outside the SCoP region.
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-clast-to-gimple.c (gloog): Remove call to
sese_adjust_liveout_phis.
* graphite-sese-to-poly.c (scev_analyzable_p): When scev returns an
SSA_NAME, allow it to be handled by rewrite_cross_bb_scalar_deps.
(rewrite_cross_bb_scalar_deps): Handle GIMPLE_PHI nodes: call
rewrite_phi_out_of_ssa.
* sese.c (get_vdef_before_sese): Removed.
(sese_adjust_vphi): Removed.
(sese_adjust_liveout_phis): Removed.
* sese.h (sese_adjust_liveout_phis): Removed.
---
gcc/ChangeLog.graphite | 13 +++
gcc/graphite-clast-to-gimple.c | 4 -
gcc/graphite-sese-to-poly.c | 13 ++-
gcc/sese.c | 159 ----------------------------------------
gcc/sese.h | 1 -
5 files changed, 22 insertions(+), 168 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 888a77d..d703048 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,18 @@
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+ * graphite-clast-to-gimple.c (gloog): Remove call to
+ sese_adjust_liveout_phis.
+ * graphite-sese-to-poly.c (scev_analyzable_p): When scev returns an
+ SSA_NAME, allow it to be handled by rewrite_cross_bb_scalar_deps.
+ (rewrite_cross_bb_scalar_deps): Handle GIMPLE_PHI nodes: call
+ rewrite_phi_out_of_ssa.
+ * sese.c (get_vdef_before_sese): Removed.
+ (sese_adjust_vphi): Removed.
+ (sese_adjust_liveout_phis): Removed.
+ * sese.h (sese_adjust_liveout_phis): Removed.
+
+2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+
* graphite-sese-to-poly.c (insert_out_of_ssa_copy): Pass an extra
argument for the place after which to insert the out of SSA copy.
(rewrite_close_phi_out_of_ssa): Update calls to insert_out_of_ssa_copy.
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index a363f5d..01adba0 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -1578,10 +1578,6 @@ gloog (scop_p scop, VEC (scop_p, heap) *scops, htab_t bb_pbb_mapping)
rename_map, &newivs, newivs_index,
bb_pbb_mapping, 1, params_index);
graphite_verify ();
- sese_adjust_liveout_phis (region, rename_map,
- if_region->region->exit->src,
- if_region->false_region->exit,
- if_region->true_region->exit);
scev_reset_htab ();
rename_nb_iterations (rename_map);
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 7bb7bb8..57967e5 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2325,7 +2325,8 @@ scev_analyzable_p (tree def, sese region)
loop_p loop = loop_containing_stmt (stmt);
tree scev = scalar_evolution_in_region (region, loop, def);
- return !chrec_contains_undetermined (scev);
+ return !chrec_contains_undetermined (scev)
+ && TREE_CODE (scev) != SSA_NAME;
}
/* Rewrite the scalar dependence of DEF used in USE_STMT with a memory
@@ -2379,9 +2380,13 @@ rewrite_cross_bb_scalar_deps (sese region, gimple_stmt_iterator *gsi)
def_bb = gimple_bb (stmt);
FOR_EACH_IMM_USE_STMT (use_stmt, imm_iter, def)
- if (def_bb != gimple_bb (use_stmt)
- && gimple_code (use_stmt) != GIMPLE_PHI
- && !is_gimple_debug (use_stmt))
+ if (gimple_code (use_stmt) == GIMPLE_PHI)
+ {
+ gimple_stmt_iterator si = gsi_for_stmt (use_stmt);
+ rewrite_phi_out_of_ssa (&si);
+ }
+ else if (def_bb != gimple_bb (use_stmt)
+ && !is_gimple_debug (use_stmt))
{
if (!zero_dim_array)
{
diff --git a/gcc/sese.c b/gcc/sese.c
index 7e9bd91..051599e 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -394,100 +394,6 @@ sese_insert_phis_for_liveouts (sese region, basic_block bb,
update_ssa (TODO_update_ssa);
}
-/* Get the definition of NAME before the SESE. Keep track of the
- basic blocks that have been VISITED in a bitmap. */
-
-static tree
-get_vdef_before_sese (sese region, tree name, sbitmap visited)
-{
- unsigned i;
- gimple stmt = SSA_NAME_DEF_STMT (name);
- basic_block def_bb = gimple_bb (stmt);
-
- if (!def_bb || !bb_in_sese_p (def_bb, region))
- return name;
-
- if (TEST_BIT (visited, def_bb->index))
- return NULL_TREE;
-
- SET_BIT (visited, def_bb->index);
-
- switch (gimple_code (stmt))
- {
- case GIMPLE_PHI:
- for (i = 0; i < gimple_phi_num_args (stmt); i++)
- {
- tree arg = gimple_phi_arg_def (stmt, i);
- tree res;
-
- if (gimple_bb (SSA_NAME_DEF_STMT (arg))
- && def_bb->index == gimple_bb (SSA_NAME_DEF_STMT (arg))->index)
- continue;
-
- res = get_vdef_before_sese (region, arg, visited);
- if (res)
- return res;
- }
- return NULL_TREE;
-
- case GIMPLE_ASSIGN:
- case GIMPLE_CALL:
- {
- use_operand_p use_p = gimple_vuse_op (stmt);
- tree use = USE_FROM_PTR (use_p);
-
- if (def_bb->index == gimple_bb (SSA_NAME_DEF_STMT (use))->index)
- RESET_BIT (visited, def_bb->index);
-
- return get_vdef_before_sese (region, use, visited);
- }
-
- default:
- return NULL_TREE;
- }
-}
-
-/* Adjust a virtual phi node PHI that is placed at the end of the
- generated code for SCOP:
-
- | if (1)
- | generated code from REGION;
- | else
- | REGION;
-
- The FALSE_E edge comes from the original code, TRUE_E edge comes
- from the code generated for the SCOP. */
-
-static void
-sese_adjust_vphi (sese region, gimple phi, edge true_e)
-{
- unsigned i;
-
- gcc_assert (gimple_phi_num_args (phi) == 2);
-
- for (i = 0; i < gimple_phi_num_args (phi); i++)
- if (gimple_phi_arg_edge (phi, i) == true_e)
- {
- tree true_arg, false_arg, before_scop_arg;
- sbitmap visited;
-
- true_arg = gimple_phi_arg_def (phi, i);
- if (!SSA_NAME_IS_DEFAULT_DEF (true_arg))
- return;
-
- false_arg = gimple_phi_arg_def (phi, i == 0 ? 1 : 0);
- if (SSA_NAME_IS_DEFAULT_DEF (false_arg))
- return;
-
- visited = sbitmap_alloc (last_basic_block);
- sbitmap_zero (visited);
- before_scop_arg = get_vdef_before_sese (region, false_arg, visited);
- gcc_assert (before_scop_arg != NULL_TREE);
- SET_PHI_ARG_DEF (phi, i, before_scop_arg);
- sbitmap_free (visited);
- }
-}
-
/* Returns the expression associated to OLD_NAME in MAP. */
static tree
@@ -585,71 +491,6 @@ rename_sese_parameters (htab_t rename_map, sese region)
rename_variables_in_expr (rename_map, p));
}
-/* Adjusts the phi nodes in the block BB for variables defined in
- SCOP_REGION and used outside the SCOP_REGION. The code generation
- moves SCOP_REGION in the else clause of an "if (1)" and generates
- code in the then clause:
-
- | if (1)
- | generated code from REGION;
- | else
- | REGION;
-
- To adjust the phi nodes after the condition, the RENAME_MAP is
- used. */
-
-void
-sese_adjust_liveout_phis (sese region, htab_t rename_map, basic_block bb,
- edge false_e, edge true_e)
-{
- gimple_stmt_iterator si;
-
- for (si = gsi_start_phis (bb); !gsi_end_p (si); gsi_next (&si))
- {
- unsigned i;
- unsigned false_i = 0;
- gimple phi = gsi_stmt (si);
- tree res = gimple_phi_result (phi);
-
- if (!is_gimple_reg (res))
- {
- sese_adjust_vphi (region, phi, true_e);
- continue;
- }
-
- for (i = 0; i < gimple_phi_num_args (phi); i++)
- if (gimple_phi_arg_edge (phi, i) == false_e)
- {
- false_i = i;
- break;
- }
-
- for (i = 0; i < gimple_phi_num_args (phi); i++)
- if (gimple_phi_arg_edge (phi, i) == true_e)
- {
- tree old_name = gimple_phi_arg_def (phi, false_i);
- tree expr = get_rename (rename_map, old_name);
- gimple_seq stmts;
-
- gcc_assert (old_name != expr);
-
- if (TREE_CODE (expr) != SSA_NAME
- && is_gimple_reg (old_name))
- {
- tree type = TREE_TYPE (old_name);
- tree var = create_tmp_var (type, "var");
-
- expr = build2 (MODIFY_EXPR, type, var, expr);
- expr = force_gimple_operand (expr, &stmts, true, NULL);
- gsi_insert_seq_on_edge_immediate (true_e, stmts);
- }
-
- SET_PHI_ARG_DEF (phi, i, expr);
- set_rename (rename_map, old_name, res);
- }
- }
-}
-
/* Rename the SSA_NAMEs used in STMT and that appear in MAP. */
static void
diff --git a/gcc/sese.h b/gcc/sese.h
index 2b05ca8..4b2e5c2 100644
--- a/gcc/sese.h
+++ b/gcc/sese.h
@@ -55,7 +55,6 @@ typedef struct sese_s
extern sese new_sese (edge, edge);
extern void free_sese (sese);
extern void sese_insert_phis_for_liveouts (sese, basic_block, edge, edge);
-extern void sese_adjust_liveout_phis (sese, htab_t, basic_block, edge, edge);
extern void build_sese_loop_nests (sese);
extern edge copy_bb_and_scalar_dependences (basic_block, sese, edge, htab_t);
extern struct loop *outermost_loop_in_sese (sese, basic_block);
--
1.7.0.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch][graphite] Remove sese_adjust_liveout_phis
2010-06-12 8:17 [patch][graphite] Remove sese_adjust_liveout_phis Sebastian Pop
@ 2010-06-12 12:03 ` Sebastian Pop
2010-06-14 18:20 ` Sebastian Pop
1 sibling, 0 replies; 5+ messages in thread
From: Sebastian Pop @ 2010-06-12 12:03 UTC (permalink / raw)
To: GCC Patches, gcc-graphite
[-- Attachment #1: Type: text/plain, Size: 934 bytes --]
On Sat, Jun 12, 2010 at 02:53, Sebastian Pop <sebpop@gmail.com> wrote:
> Hi,
>
> with the attached patches we no longer need to use the rename_map to
> substitute the arguments of the phi nodes created after the code
> generated by Graphite. I committed these patches to the graphite
> branch, and I will commit them to trunk once they pass the usual
> graphite branch tests.
>
> The aim is to replace the rename_map with the map that CLooG exposes
> for each user statement: associating to a loop level an expression.
> The expand_* functions will be replaced by the code generation from a
> chrec that is obtained from the original scev by chrec_applying the
> loop level -> expression map on each varying loop. This will then
> allow us to remove the call to the IV canonicalization from Graphite.
>
The attached patch removes two uses of rename_map from gloog.
Committed to the graphite branch.
Sebastian
[-- Attachment #2: 0001-Remove-rename_nb_iterations-and-rename_sese_paramete.patch --]
[-- Type: text/x-diff, Size: 6278 bytes --]
From be9a6b386261452607f5440a46bbfb10700bf3d3 Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Sat, 12 Jun 2010 03:12:04 -0500
Subject: [PATCH] Remove rename_nb_iterations and rename_sese_parameters
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-clast-to-gimple.c (gloog): Do not pass scops in parameter.
Remove calls to rename_nb_iterations and rename_sese_parameters.
* graphite-clast-to-gimple.h (gloog): Update declaration.
* graphite.c (graphite_transform_loops): Update call to gloog.
* sese.c (rename_variables_in_expr): Removed.
(rename_nb_iterations): Removed.
(rename_sese_parameters): Removed.
* sese.h (rename_nb_iterations): Removed.
(rename_sese_parameters): Removed.
---
gcc/ChangeLog.graphite | 12 ++++++++
gcc/graphite-clast-to-gimple.c | 8 +-----
gcc/graphite-clast-to-gimple.h | 2 +-
gcc/graphite.c | 2 +-
gcc/sese.c | 56 ----------------------------------------
gcc/sese.h | 2 -
6 files changed, 15 insertions(+), 67 deletions(-)
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index d703048..b4e2700 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,17 @@
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+ * graphite-clast-to-gimple.c (gloog): Do not pass scops in parameter.
+ Remove calls to rename_nb_iterations and rename_sese_parameters.
+ * graphite-clast-to-gimple.h (gloog): Update declaration.
+ * graphite.c (graphite_transform_loops): Update call to gloog.
+ * sese.c (rename_variables_in_expr): Removed.
+ (rename_nb_iterations): Removed.
+ (rename_sese_parameters): Removed.
+ * sese.h (rename_nb_iterations): Removed.
+ (rename_sese_parameters): Removed.
+
+2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
+
* graphite-clast-to-gimple.c (gloog): Remove call to
sese_adjust_liveout_phis.
* graphite-sese-to-poly.c (scev_analyzable_p): When scev returns an
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index 01adba0..54801ce 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -1531,7 +1531,7 @@ create_params_index (htab_t index_table, CloogProgram *prog) {
*/
bool
-gloog (scop_p scop, VEC (scop_p, heap) *scops, htab_t bb_pbb_mapping)
+gloog (scop_p scop, htab_t bb_pbb_mapping)
{
VEC (tree, heap) *newivs = VEC_alloc (tree, heap, 10);
loop_p context_loop;
@@ -1539,7 +1539,6 @@ gloog (scop_p scop, VEC (scop_p, heap) *scops, htab_t bb_pbb_mapping)
ifsese if_region = NULL;
htab_t rename_map, newivs_index, params_index;
cloog_prog_clast pc;
- int i;
timevar_push (TV_GRAPHITE_CODE_GEN);
gloog_error = false;
@@ -1579,11 +1578,6 @@ gloog (scop_p scop, VEC (scop_p, heap) *scops, htab_t bb_pbb_mapping)
bb_pbb_mapping, 1, params_index);
graphite_verify ();
scev_reset_htab ();
- rename_nb_iterations (rename_map);
-
- for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
- rename_sese_parameters (rename_map, SCOP_REGION (scop));
-
recompute_all_dominators ();
graphite_verify ();
diff --git a/gcc/graphite-clast-to-gimple.h b/gcc/graphite-clast-to-gimple.h
index f6557f6..c90cfc0 100644
--- a/gcc/graphite-clast-to-gimple.h
+++ b/gcc/graphite-clast-to-gimple.h
@@ -36,7 +36,7 @@ typedef struct bb_pbb_def
poly_bb_p pbb;
}bb_pbb_def;
-extern bool gloog (scop_p, VEC (scop_p, heap) *, htab_t);
+extern bool gloog (scop_p, htab_t);
extern cloog_prog_clast scop_to_clast (scop_p);
extern void debug_clast_stmt (struct clast_stmt *);
extern void print_clast_stmt (FILE *, struct clast_stmt *);
diff --git a/gcc/graphite.c b/gcc/graphite.c
index 5f28aeb..51bf800 100644
--- a/gcc/graphite.c
+++ b/gcc/graphite.c
@@ -289,7 +289,7 @@ graphite_transform_loops (void)
for (i = 0; VEC_iterate (scop_p, scops, i, scop); i++)
if (POLY_SCOP_P (scop)
&& apply_poly_transforms (scop)
- && gloog (scop, scops, bb_pbb_mapping))
+ && gloog (scop, bb_pbb_mapping))
need_cfg_cleanup_p = true;
htab_delete (bb_pbb_mapping);
diff --git a/gcc/sese.c b/gcc/sese.c
index 051599e..361c9b6 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -435,62 +435,6 @@ set_rename (htab_t map, tree old_name, tree expr)
*slot = new_rename_map_elt (old_name, expr);
}
-/* Renames the expression T following the tuples (OLD_NAME, EXPR) in
- the rename map M. Returns the expression T after renaming. */
-
-static tree
-rename_variables_in_expr (htab_t m, tree t)
-{
- if (!t)
- return t;
-
- if (TREE_CODE (t) == SSA_NAME)
- return get_rename (m, t);
-
- switch (TREE_CODE_LENGTH (TREE_CODE (t)))
- {
- case 3:
- TREE_OPERAND (t, 2) = rename_variables_in_expr (m, TREE_OPERAND (t, 2));
-
- case 2:
- TREE_OPERAND (t, 1) = rename_variables_in_expr (m, TREE_OPERAND (t, 1));
-
- case 1:
- TREE_OPERAND (t, 0) = rename_variables_in_expr (m, TREE_OPERAND (t, 0));
-
- default:
- return t;
- }
-}
-
-/* Renames all the loop->nb_iterations expressions following the
- tuples (OLD_NAME, EXPR) in RENAME_MAP. */
-
-void
-rename_nb_iterations (htab_t rename_map)
-{
- loop_iterator li;
- struct loop *loop;
-
- FOR_EACH_LOOP (li, loop, 0)
- loop->nb_iterations = rename_variables_in_expr (rename_map,
- loop->nb_iterations);
-}
-
-/* Renames all the parameters of SESE following the tuples (OLD_NAME,
- EXPR) in RENAME_MAP. */
-
-void
-rename_sese_parameters (htab_t rename_map, sese region)
-{
- int i;
- tree p;
-
- for (i = 0; VEC_iterate (tree, SESE_PARAMS (region), i, p); i++)
- VEC_replace (tree, SESE_PARAMS (region), i,
- rename_variables_in_expr (rename_map, p));
-}
-
/* Rename the SSA_NAMEs used in STMT and that appear in MAP. */
static void
diff --git a/gcc/sese.h b/gcc/sese.h
index 4b2e5c2..d0d829f 100644
--- a/gcc/sese.h
+++ b/gcc/sese.h
@@ -262,8 +262,6 @@ extern void debug_rename_map (htab_t);
extern hashval_t rename_map_elt_info (const void *);
extern int eq_rename_map_elts (const void *, const void *);
extern void set_rename (htab_t, tree, tree);
-extern void rename_nb_iterations (htab_t);
-extern void rename_sese_parameters (htab_t, sese);
/* Constructs a new SCEV_INFO_STR structure for VAR and INSTANTIATED_BELOW. */
--
1.7.0.4
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch][graphite] Remove sese_adjust_liveout_phis
2010-06-12 8:17 [patch][graphite] Remove sese_adjust_liveout_phis Sebastian Pop
2010-06-12 12:03 ` Sebastian Pop
@ 2010-06-14 18:20 ` Sebastian Pop
2010-06-15 9:31 ` Richard Guenther
1 sibling, 1 reply; 5+ messages in thread
From: Sebastian Pop @ 2010-06-14 18:20 UTC (permalink / raw)
To: GCC Patches, gcc-graphite, Richard Guenther
Hi,
On Sat, Jun 12, 2010 at 02:53, Sebastian Pop <sebpop@gmail.com> wrote:
> Hi,
>
> with the attached patches we no longer need to use the rename_map to
> substitute the arguments of the phi nodes created after the code
> generated by Graphite. I committed these patches to the graphite
> branch, and I will commit them to trunk once they pass the usual
> graphite branch tests.
>
> The aim is to replace the rename_map with the map that CLooG exposes
> for each user statement: associating to a loop level an expression.
> The expand_* functions will be replaced by the code generation from a
> chrec that is obtained from the original scev by chrec_applying the
> loop level -> expression map on each varying loop. This will then
> allow us to remove the call to the IV canonicalization from Graphite.
>
One of these patches broke 464.h264ref: here is a reduced testcase
/* { dg-options "-O3 -fgraphite-identity -ffast-math" } */
typedef enum
{
I_SLICE,
} SliceType;
typedef struct
{
int type;
} ImageParameters;
extern ImageParameters *img;
int A[64], B[64], C[13][8][8], D[13][8][8];
void
foo (int q, int temp)
{
int i, j, k;
for(k=0; k<13; k++)
for(j=0; j<8; j++)
for(i=0; i<8; i++)
{
if (img->type == I_SLICE)
C[k][j][i] = A[temp] << q;
D[k][j][i] = B[temp] << q;
}
}
The problem is that img->type is moved out of the loop, making it a
parameter of the loop, and then this parameter is copied inside the
first loop:
p = img->type;
loop_1
q = p
loop_2
loop_3
if (q == 0) etc.
Now because we rewrite the scalar dependence into a data dependence,
p = img->type;
loop_1
q = p
cross_bb_dependence[0] = q
loop_2
loop_3
if (cross_bb_dependence[0] == 0) etc.
scev is not smart enough to infer that cross_bb_dependence[0] is a
parameter defined outside the scop.
A possible fix for this is to run copy propagation before Graphite:
diff --git a/gcc/passes.c b/gcc/passes.c
index ad444fd..a646d19 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -897,6 +897,7 @@ init_optimization_passes (void)
NEXT_PASS (pass_check_data_deps);
NEXT_PASS (pass_loop_distribution);
NEXT_PASS (pass_linear_transform);
+ NEXT_PASS (pass_copy_prop);
NEXT_PASS (pass_graphite_transforms);
{
struct opt_pass **p = &pass_graphite_transforms.pass.sub;
I don't know how to make the execution of copy_prop conditional to the
execution of Graphite. Any suggestions?
Thanks,
Sebastian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch][graphite] Remove sese_adjust_liveout_phis
2010-06-14 18:20 ` Sebastian Pop
@ 2010-06-15 9:31 ` Richard Guenther
2010-06-15 15:53 ` Sebastian Pop
0 siblings, 1 reply; 5+ messages in thread
From: Richard Guenther @ 2010-06-15 9:31 UTC (permalink / raw)
To: Sebastian Pop; +Cc: GCC Patches, gcc-graphite
[-- Attachment #1: Type: TEXT/PLAIN, Size: 2825 bytes --]
On Mon, 14 Jun 2010, Sebastian Pop wrote:
> Hi,
>
> On Sat, Jun 12, 2010 at 02:53, Sebastian Pop <sebpop@gmail.com> wrote:
> > Hi,
> >
> > with the attached patches we no longer need to use the rename_map to
> > substitute the arguments of the phi nodes created after the code
> > generated by Graphite. Â I committed these patches to the graphite
> > branch, and I will commit them to trunk once they pass the usual
> > graphite branch tests.
> >
> > The aim is to replace the rename_map with the map that CLooG exposes
> > for each user statement: associating to a loop level an expression.
> > The expand_* functions will be replaced by the code generation from a
> > chrec that is obtained from the original scev by chrec_applying the
> > loop level -> expression map on each varying loop. Â This will then
> > allow us to remove the call to the IV canonicalization from Graphite.
> >
>
> One of these patches broke 464.h264ref: here is a reduced testcase
>
> /* { dg-options "-O3 -fgraphite-identity -ffast-math" } */
>
> typedef enum
> {
> I_SLICE,
> } SliceType;
> typedef struct
> {
> int type;
> } ImageParameters;
> extern ImageParameters *img;
> int A[64], B[64], C[13][8][8], D[13][8][8];
>
> void
> foo (int q, int temp)
> {
> int i, j, k;
> for(k=0; k<13; k++)
> for(j=0; j<8; j++)
> for(i=0; i<8; i++)
> {
> if (img->type == I_SLICE)
> C[k][j][i] = A[temp] << q;
> D[k][j][i] = B[temp] << q;
> }
> }
>
> The problem is that img->type is moved out of the loop, making it a
> parameter of the loop, and then this parameter is copied inside the
> first loop:
>
> p = img->type;
> loop_1
> q = p
> loop_2
> loop_3
> if (q == 0) etc.
>
> Now because we rewrite the scalar dependence into a data dependence,
>
> p = img->type;
> loop_1
> q = p
> cross_bb_dependence[0] = q
> loop_2
> loop_3
> if (cross_bb_dependence[0] == 0) etc.
>
> scev is not smart enough to infer that cross_bb_dependence[0] is a
> parameter defined outside the scop.
>
> A possible fix for this is to run copy propagation before Graphite:
>
> diff --git a/gcc/passes.c b/gcc/passes.c
> index ad444fd..a646d19 100644
> --- a/gcc/passes.c
> +++ b/gcc/passes.c
> @@ -897,6 +897,7 @@ init_optimization_passes (void)
> NEXT_PASS (pass_check_data_deps);
> NEXT_PASS (pass_loop_distribution);
> NEXT_PASS (pass_linear_transform);
> + NEXT_PASS (pass_copy_prop);
> NEXT_PASS (pass_graphite_transforms);
> {
> struct opt_pass **p = &pass_graphite_transforms.pass.sub;
>
>
> I don't know how to make the execution of copy_prop conditional to the
> execution of Graphite. Any suggestions?
Make pass_graphite_transforms a wrapper only (similar to
pass_tree_loop), put the real graphite-transforms pass inside,
preceeded by copyprop.
Richard.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [patch][graphite] Remove sese_adjust_liveout_phis
2010-06-15 9:31 ` Richard Guenther
@ 2010-06-15 15:53 ` Sebastian Pop
0 siblings, 0 replies; 5+ messages in thread
From: Sebastian Pop @ 2010-06-15 15:53 UTC (permalink / raw)
To: Richard Guenther; +Cc: GCC Patches, gcc-graphite
[-- Attachment #1: Type: text/plain, Size: 347 bytes --]
On Tue, Jun 15, 2010 at 03:21, Richard Guenther <rguenther@suse.de> wrote:
> Make pass_graphite_transforms a wrapper only (similar to
> pass_tree_loop), put the real graphite-transforms pass inside,
> preceeded by copyprop.
Thanks for the recommendation.
Attached is the patch that I committed to the Graphite branch for further test.
Sebastian
[-- Attachment #2: 0001-Schedule-a-copy_prop-pass-before-graphite.patch --]
[-- Type: text/x-diff, Size: 4961 bytes --]
From 5bc5d64aa606ee3de31585856367485eed3d00bd Mon Sep 17 00:00:00 2001
From: Sebastian Pop <sebpop@gmail.com>
Date: Mon, 14 Jun 2010 12:23:00 -0500
Subject: [PATCH] Schedule a copy_prop pass before graphite.
2010-06-15 Sebastian Pop <sebastian.pop@amd.com>
* passes.c (init_optimization_passes): Add pass_graphite.
Schedule a pass_copy_prop before pass_graphite_transforms.
* timevar.def (TV_GRAPHITE): Declared.
* tree-pass.h (pass_graphite): Declared.
* tree-ssa-loop.c (pass_graphite): New.
* gcc.dg/graphite/id-20.c: New.
---
gcc/ChangeLog.graphite | 10 ++++++++++
gcc/passes.c | 7 +++++--
gcc/testsuite/gcc.dg/graphite/id-20.c | 26 ++++++++++++++++++++++++++
gcc/timevar.def | 1 +
gcc/tree-pass.h | 1 +
gcc/tree-ssa-loop.c | 19 +++++++++++++++++++
6 files changed, 62 insertions(+), 2 deletions(-)
create mode 100644 gcc/testsuite/gcc.dg/graphite/id-20.c
diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index b4e2700..fa75c61 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,3 +1,13 @@
+2010-06-15 Sebastian Pop <sebastian.pop@amd.com>
+
+ * passes.c (init_optimization_passes): Add pass_graphite.
+ Schedule a pass_copy_prop before pass_graphite_transforms.
+ * timevar.def (TV_GRAPHITE): Declared.
+ * tree-pass.h (pass_graphite): Declared.
+ * tree-ssa-loop.c (pass_graphite): New.
+
+ * gcc.dg/graphite/id-20.c: New.
+
2010-06-12 Sebastian Pop <sebastian.pop@amd.com>
* graphite-clast-to-gimple.c (gloog): Do not pass scops in parameter.
diff --git a/gcc/passes.c b/gcc/passes.c
index ad444fd..093d8e8 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -897,9 +897,12 @@ init_optimization_passes (void)
NEXT_PASS (pass_check_data_deps);
NEXT_PASS (pass_loop_distribution);
NEXT_PASS (pass_linear_transform);
- NEXT_PASS (pass_graphite_transforms);
+ NEXT_PASS (pass_copy_prop);
+ NEXT_PASS (pass_graphite);
{
- struct opt_pass **p = &pass_graphite_transforms.pass.sub;
+ struct opt_pass **p = &pass_graphite.pass.sub;
+ NEXT_PASS (pass_copy_prop);
+ NEXT_PASS (pass_graphite_transforms);
NEXT_PASS (pass_copy_prop);
NEXT_PASS (pass_dce_loop);
NEXT_PASS (pass_lim);
diff --git a/gcc/testsuite/gcc.dg/graphite/id-20.c b/gcc/testsuite/gcc.dg/graphite/id-20.c
new file mode 100644
index 0000000..7e0cf6d
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/graphite/id-20.c
@@ -0,0 +1,26 @@
+/* { dg-options "-O3 -fgraphite-identity -ffast-math" } */
+
+typedef enum
+{
+ I_SLICE,
+} SliceType;
+typedef struct
+{
+ int type;
+} ImageParameters;
+extern ImageParameters *img;
+int A[64], B[64], C[13][8][8], D[13][8][8];
+
+void
+foo (int q, int temp)
+{
+ int i, j, k;
+ for(k=0; k<13; k++)
+ for(j=0; j<8; j++)
+ for(i=0; i<8; i++)
+ {
+ if (img->type == I_SLICE)
+ C[k][j][i] = A[temp] << q;
+ D[k][j][i] = B[temp] << q;
+ }
+}
diff --git a/gcc/timevar.def b/gcc/timevar.def
index a6ee4d2..9d56124 100644
--- a/gcc/timevar.def
+++ b/gcc/timevar.def
@@ -146,6 +146,7 @@ DEFTIMEVAR (TV_COMPLETE_UNROLL , "complete unrolling")
DEFTIMEVAR (TV_TREE_PARALLELIZE_LOOPS, "tree parallelize loops")
DEFTIMEVAR (TV_TREE_VECTORIZATION , "tree vectorization")
DEFTIMEVAR (TV_TREE_SLP_VECTORIZATION, "tree slp vectorization")
+DEFTIMEVAR (TV_GRAPHITE , "Graphite")
DEFTIMEVAR (TV_GRAPHITE_TRANSFORMS , "Graphite loop transforms")
DEFTIMEVAR (TV_GRAPHITE_DATA_DEPS , "Graphite data dep analysis")
DEFTIMEVAR (TV_GRAPHITE_CODE_GEN , "Graphite code generation")
diff --git a/gcc/tree-pass.h b/gcc/tree-pass.h
index b5971d5..9af12d9 100644
--- a/gcc/tree-pass.h
+++ b/gcc/tree-pass.h
@@ -372,6 +372,7 @@ extern struct gimple_opt_pass pass_iv_canon;
extern struct gimple_opt_pass pass_scev_cprop;
extern struct gimple_opt_pass pass_empty_loop;
extern struct gimple_opt_pass pass_record_bounds;
+extern struct gimple_opt_pass pass_graphite;
extern struct gimple_opt_pass pass_graphite_transforms;
extern struct gimple_opt_pass pass_if_conversion;
extern struct gimple_opt_pass pass_loop_distribution;
diff --git a/gcc/tree-ssa-loop.c b/gcc/tree-ssa-loop.c
index 344cfa8..006688a 100644
--- a/gcc/tree-ssa-loop.c
+++ b/gcc/tree-ssa-loop.c
@@ -309,6 +309,25 @@ gate_graphite_transforms (void)
return flag_graphite != 0;
}
+struct gimple_opt_pass pass_graphite =
+{
+ {
+ GIMPLE_PASS,
+ "graphite0", /* name */
+ gate_graphite_transforms, /* gate */
+ NULL, /* execute */
+ NULL, /* sub */
+ NULL, /* next */
+ 0, /* static_pass_number */
+ TV_GRAPHITE, /* tv_id */
+ PROP_cfg | PROP_ssa, /* properties_required */
+ 0, /* properties_provided */
+ 0, /* properties_destroyed */
+ 0, /* todo_flags_start */
+ 0 /* todo_flags_finish */
+ }
+};
+
struct gimple_opt_pass pass_graphite_transforms =
{
{
--
1.7.0.4
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-06-15 15:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-06-12 8:17 [patch][graphite] Remove sese_adjust_liveout_phis Sebastian Pop
2010-06-12 12:03 ` Sebastian Pop
2010-06-14 18:20 ` Sebastian Pop
2010-06-15 9:31 ` Richard Guenther
2010-06-15 15:53 ` 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).