public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Pop <sebpop@gmail.com>
To: gcc-patches@gcc.gnu.org
Cc: gcc-graphite@googlegroups.com,	Sebastian Pop <sebpop@gmail.com>
Subject: [PATCH 01/12] Remove insert_loop_close_phis.
Date: Fri, 16 Jul 2010 07:05:00 -0000	[thread overview]
Message-ID: <1279263843-9149-2-git-send-email-sebpop@gmail.com> (raw)
In-Reply-To: <1279263843-9149-1-git-send-email-sebpop@gmail.com>

2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>

	* graphite-clast-to-gimple.c (translate_clast_for_loop): Do not call
	insert_loop_close_phis.
	* sese.c (name_defined_in_loop_p): Removed.
	(expr_defined_in_loop_p): Removed.
	(alive_after_loop): Removed.
	(close_phi_not_yet_inserted_p): Removed.
	(struct alep): Removed.
	(add_loop_exit_phis): Removed.
	(insert_loop_close_phis): Removed.
---
 gcc/ChangeLog.graphite         |   19 ++++-
 gcc/graphite-clast-to-gimple.c |    4 -
 gcc/sese.c                     |  167 ----------------------------------------
 3 files changed, 15 insertions(+), 175 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 6d915a7..3774b46 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,9 +1,20 @@
+2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>
+
+	* graphite-clast-to-gimple.c (translate_clast_for_loop): Do not call
+	insert_loop_close_phis.
+	* sese.c (name_defined_in_loop_p): Removed.
+	(expr_defined_in_loop_p): Removed.
+	(alive_after_loop): Removed.
+	(close_phi_not_yet_inserted_p): Removed.
+	(struct alep): Removed.
+	(add_loop_exit_phis): Removed.
+	(insert_loop_close_phis): Removed.
+
 2010-07-15  Andreas Simbuerger  <simbuerg@fim.uni-passau.de>
 
-	* graphite-cloog-util.c
-	(cloog_matrix_to_ppl_constraint): Fix flipped condition.
-	* graphite-poly.c
-	(psct_scattering_dim_for_loop_depth): Same.
+	* graphite-cloog-util.c	(cloog_matrix_to_ppl_constraint): Fix flipped
+	condition.
+	* graphite-poly.c (psct_scattering_dim_for_loop_depth): Same.
 
 2010-07-07  Sebastian Pop  <sebastian.pop@amd.com>
 
diff --git a/gcc/graphite-clast-to-gimple.c b/gcc/graphite-clast-to-gimple.c
index d12f177..042857f 100644
--- a/gcc/graphite-clast-to-gimple.c
+++ b/gcc/graphite-clast-to-gimple.c
@@ -1046,10 +1046,6 @@ translate_clast_for_loop (sese region, loop_p context_loop,
   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)))
diff --git a/gcc/sese.c b/gcc/sese.c
index 6883073..e0c06da 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -888,173 +888,6 @@ get_false_edge_from_guard_bb (basic_block bb)
   return NULL;
 }
 
-/* Returns true when NAME is defined in LOOP.  */
-
-static bool
-name_defined_in_loop_p (tree name, loop_p loop)
-{
-  return !SSA_NAME_IS_DEFAULT_DEF (name)
-    && gimple_bb (SSA_NAME_DEF_STMT (name))->loop_father == loop;
-}
-
-/* Returns true when EXPR contains SSA_NAMEs defined in LOOP.  */
-
-static bool
-expr_defined_in_loop_p (tree expr, loop_p loop)
-{
-  switch (TREE_CODE_LENGTH (TREE_CODE (expr)))
-    {
-    case 3:
-      return expr_defined_in_loop_p (TREE_OPERAND (expr, 0), loop)
-	|| expr_defined_in_loop_p (TREE_OPERAND (expr, 1), loop)
-	|| expr_defined_in_loop_p (TREE_OPERAND (expr, 2), loop);
-
-    case 2:
-      return expr_defined_in_loop_p (TREE_OPERAND (expr, 0), loop)
-	|| expr_defined_in_loop_p (TREE_OPERAND (expr, 1), loop);
-
-    case 1:
-      return expr_defined_in_loop_p (TREE_OPERAND (expr, 0), loop);
-
-    case 0:
-      return TREE_CODE (expr) == SSA_NAME
-	&& name_defined_in_loop_p (expr, loop);
-
-    default:
-      return false;
-    }
-}
-
-/* Returns the gimple statement that uses NAME outside the loop it is
-   defined in, returns NULL if there is no such loop close phi node.
-   An invariant of the loop closed SSA form is that the only use of a
-   variable, outside the loop it is defined in, is in the loop close
-   phi node that just follows the loop.  */
-
-static gimple
-alive_after_loop (tree name)
-{
-  use_operand_p use_p;
-  imm_use_iterator imm_iter;
-  loop_p loop = gimple_bb (SSA_NAME_DEF_STMT (name))->loop_father;
-
-  FOR_EACH_IMM_USE_FAST (use_p, imm_iter, name)
-    {
-      gimple stmt = USE_STMT (use_p);
-
-      if (gimple_code (stmt) == GIMPLE_PHI
-	  && gimple_bb (stmt)->loop_father != loop)
-	return stmt;
-    }
-
-  return NULL;
-}
-
-/* Return true if a close phi has not yet been inserted for the use of
-   variable NAME on the single exit of LOOP.  */
-
-static bool
-close_phi_not_yet_inserted_p (loop_p loop, tree name)
-{
-  gimple_stmt_iterator psi;
-  basic_block bb = single_exit (loop)->dest;
-
-  for (psi = gsi_start_phis (bb); !gsi_end_p (psi); gsi_next (&psi))
-    if (gimple_phi_arg_def (gsi_stmt (psi), 0) == name)
-      return false;
-
-  return true;
-}
-
-/* A structure for passing parameters to add_loop_exit_phis.  */
-
-typedef struct alep {
-  loop_p loop;
-  VEC (rename_map_elt, heap) *new_renames;
-} *alep_p;
-
-/* Helper function for htab_traverse in insert_loop_close_phis.  */
-
-static int
-add_loop_exit_phis (void **slot, void *data)
-{
-  struct rename_map_elt_s *entry;
-  alep_p a;
-  loop_p loop;
-  tree expr, new_name, old_name;
-  bool def_in_loop_p, used_outside_p, need_close_phi_p;
-  gimple old_close_phi;
-
-  if (!slot || !*slot || !data)
-    return 1;
-
-  entry = (struct rename_map_elt_s *) *slot;
-  a = (alep_p) data;
-  loop = a->loop;
-  new_name = expr = entry->expr;
-  old_name = entry->old_name;
-
-  def_in_loop_p = expr_defined_in_loop_p (expr, loop);
-  if (!def_in_loop_p)
-    return 1;
-
-  /* Remove the old rename from the map when the expression is defined
-     in the loop that we're closing.  */
-  free (*slot);
-  *slot = NULL;
-
-  if (TREE_CODE (expr) != SSA_NAME)
-    return 1;
-
-  old_close_phi = alive_after_loop (old_name);
-  used_outside_p = (old_close_phi != NULL);
-  need_close_phi_p = (used_outside_p
-		      && close_phi_not_yet_inserted_p (loop, new_name));
-
-  /* Insert a loop close phi node.  */
-  if (need_close_phi_p)
-    {
-      basic_block bb = single_exit (loop)->dest;
-      gimple phi = create_phi_node (new_name, bb);
-      tree new_res = create_new_def_for (gimple_phi_result (phi), phi,
-					 gimple_phi_result_ptr (phi));
-
-      add_phi_arg (phi, new_name, single_pred_edge (bb), UNKNOWN_LOCATION);
-      VEC_safe_push (rename_map_elt, heap, a->new_renames,
-		     new_rename_map_elt (gimple_phi_result (old_close_phi),
-					 new_res));
-    }
-
-  return 1;
-}
-
-/* Traverses MAP and removes from it all the tuples (OLD, NEW) where
-   NEW is defined in LOOP.  Inserts on the exit of LOOP the close phi
-   node "RES = phi (NEW)" corresponding to "OLD_RES = phi (OLD)" in
-   the original code.  Inserts in MAP the tuple (OLD_RES, RES).  */
-
-void
-insert_loop_close_phis (htab_t map, loop_p loop)
-{
-  int i;
-  struct alep a;
-  rename_map_elt elt;
-
-  a.loop = loop;
-  a.new_renames = VEC_alloc (rename_map_elt, heap, 3);
-  update_ssa (TODO_update_ssa);
-  htab_traverse (map, add_loop_exit_phis, &a);
-  update_ssa (TODO_update_ssa);
-
-  for (i = 0; VEC_iterate (rename_map_elt, a.new_renames, i, elt); i++)
-    {
-      set_rename (map, elt->old_name, elt->expr);
-      free (elt);
-    }
-
-  VEC_free (rename_map_elt, heap, a.new_renames);
-}
-
 /* Helper structure for htab_traverse in insert_guard_phis.  */
 
 struct igp {
-- 
1.7.0.4

  parent reply	other threads:[~2010-07-16  7:04 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-16  7:04 [PATCH 00/12] [graphite] Remove the induction variable canonicalization Sebastian Pop
2010-07-16  7:04 ` [PATCH 03/12] chrec_apply should only apply to the specified variable Sebastian Pop
2010-07-16  7:04 ` [PATCH 07/12] Scevs could be expressions without chrecs and still be scev_analyzable_p Sebastian Pop
2010-07-16  7:04 ` [PATCH 09/12] Add testcase for PR42729 and fix handling of gimple_debug info Sebastian Pop
2010-07-16  7:05 ` Sebastian Pop [this message]
2010-07-16  7:05 ` [PATCH 11/12] Do not rewrite out of SSA scalar phi nodes that can be scev_analyzable_p Sebastian Pop
2010-07-16  7:05 ` [PATCH 12/12] Unshare the scev before code generating it Sebastian Pop
2010-07-16  7:05 ` [PATCH 08/12] Special case non close-phi nodes with one argument in rewrite_close_phi_out_of_ssa Sebastian Pop
2010-07-16  7:05 ` [PATCH 05/12] Remove uses of loop->single_iv Sebastian Pop
2010-07-16  7:05 ` [PATCH 02/12] Remove expand_scalar_variables_ hack Sebastian Pop
2010-07-16  7:05 ` [PATCH 04/12] Also handle GIMPLE_CALLs in rewrite_cross_bb_scalar_deps Sebastian Pop
2010-07-16  7:05 ` [PATCH 10/12] Correctly handle SSA_NAME_IS_DEFAULT_DEF in rewrite_close_phi_out_of_ssa Sebastian Pop
2010-07-16  7:05 ` [PATCH 06/12] Bump the size of scevs Sebastian Pop
2010-07-16  8:03   ` Richard Guenther
2010-07-16 14:41     ` Sebastian Pop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1279263843-9149-2-git-send-email-sebpop@gmail.com \
    --to=sebpop@gmail.com \
    --cc=gcc-graphite@googlegroups.com \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).