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 05/12] Remove uses of loop->single_iv.
Date: Fri, 16 Jul 2010 07:05:00 -0000	[thread overview]
Message-ID: <1279263843-9149-6-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>

	* cfgloop.c (alloc_loop): Remove initialization of loop->single_iv.
	* cfgloop.h (struct loop): Remove single_iv field.
	* graphite-sese-to-poly.c (graphite_loop_normal_form): Removed.
	(scop_canonicalize_loops): Removed.
	(scop_ivs_can_be_represented): Do not use loop->single_iv.  Iterate
	over all the loop phi nodes in loop->header.
	(build_poly_scop): Remove use of scop_canonicalize_loops.
---
 gcc/ChangeLog.graphite      |   10 +++++++
 gcc/cfgloop.c               |    1 -
 gcc/cfgloop.h               |    4 ---
 gcc/graphite-sese-to-poly.c |   62 +++++++-----------------------------------
 4 files changed, 21 insertions(+), 56 deletions(-)

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index a83cc99..8408cf2 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,5 +1,15 @@
 2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>
 
+	* cfgloop.c (alloc_loop): Remove initialization of loop->single_iv.
+	* cfgloop.h (struct loop): Remove single_iv field.
+	* graphite-sese-to-poly.c (graphite_loop_normal_form): Removed.
+	(scop_canonicalize_loops): Removed.
+	(scop_ivs_can_be_represented): Do not use loop->single_iv.  Iterate
+	over all the loop phi nodes in loop->header.
+	(build_poly_scop): Remove use of scop_canonicalize_loops.
+
+2010-07-15  Sebastian Pop  <sebastian.pop@amd.com>
+
 	* graphite-sese-to-poly.c (rewrite_cross_bb_scalar_deps): Also
 	handle GIMPLE_CALL.
 
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 858e75b..0a8ceba 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -339,7 +339,6 @@ alloc_loop (void)
   loop->exits = GGC_CNEW (struct loop_exit);
   loop->exits->next = loop->exits->prev = loop->exits;
   loop->can_be_parallel = false;
-  loop->single_iv = NULL_TREE;
 
   return loop;
 }
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 3821ee6..4d16a23 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -165,10 +165,6 @@ struct GTY ((chain_next ("%h.next"))) loop {
 
   /* Head of the cyclic list of the exits of the loop.  */
   struct loop_exit *exits;
-
-  /* The single induction variable of the loop when the loop is in
-     normal form.  */
-  tree single_iv;
 };
 
 /* Flags for state of loop structure.  */
diff --git a/gcc/graphite-sese-to-poly.c b/gcc/graphite-sese-to-poly.c
index 22f9536..9c54f0b 100644
--- a/gcc/graphite-sese-to-poly.c
+++ b/gcc/graphite-sese-to-poly.c
@@ -2905,45 +2905,6 @@ rewrite_commutative_reductions_out_of_ssa (sese region, sbitmap reductions)
 #endif
 }
 
-/* A LOOP is in normal form for Graphite when it contains only one
-   scalar phi node that defines the main induction variable of the
-   loop, only one increment of the IV, and only one exit condition.  */
-
-static void
-graphite_loop_normal_form (loop_p loop)
-{
-  struct tree_niter_desc niter;
-  tree nit;
-  gimple_seq stmts;
-  edge exit = single_dom_exit (loop);
-
-  bool known_niter = number_of_iterations_exit (loop, exit, &niter, false);
-
-  /* At this point we should know the number of iterations.  */
-  gcc_assert (known_niter);
-
-  nit = force_gimple_operand (unshare_expr (niter.niter), &stmts, true,
-			      NULL_TREE);
-  if (stmts)
-    gsi_insert_seq_on_edge_immediate (loop_preheader_edge (loop), stmts);
-
-  loop->single_iv = canonicalize_loop_ivs (loop, &nit, false);
-}
-
-/* Rewrite all the loops of SCOP in normal form: one induction
-   variable per loop.  */
-
-static void
-scop_canonicalize_loops (scop_p scop)
-{
-  loop_iterator li;
-  loop_p loop;
-
-  FOR_EACH_LOOP (li, loop, 0)
-    if (loop_in_sese_p (loop, SCOP_REGION (scop)))
-      graphite_loop_normal_form (loop);
-}
-
 /* Java does not initialize long_long_integer_type_node.  */
 #define my_long_long (long_long_integer_type_node ? long_long_integer_type_node : ssizetype)
 
@@ -2956,24 +2917,24 @@ scop_ivs_can_be_represented (scop_p scop)
 {
   loop_iterator li;
   loop_p loop;
+  gimple_stmt_iterator psi;
 
   FOR_EACH_LOOP (li, loop, 0)
     {
-      tree type;
-      int precision;
-
       if (!loop_in_sese_p (loop, SCOP_REGION (scop)))
 	continue;
 
-      if (!loop->single_iv)
-	continue;
-
-      type = TREE_TYPE (loop->single_iv);
-      precision = TYPE_PRECISION (type);
+      for (psi = gsi_start_phis (loop->header);
+	   !gsi_end_p (psi); gsi_next (&psi))
+	{
+	  gimple phi = gsi_stmt (psi);
+	  tree res = PHI_RESULT (phi);
+	  tree type = TREE_TYPE (res);
 
-      if (TYPE_UNSIGNED (type)
-	  && precision >= TYPE_PRECISION (my_long_long))
-	return false;
+	  if (TYPE_UNSIGNED (type)
+	      && TYPE_PRECISION (type) >= TYPE_PRECISION (my_long_long))
+	    return false;
+	}
     }
 
   return true;
@@ -2997,7 +2958,6 @@ build_poly_scop (scop_p scop)
   if (nb_pbbs_in_loops (scop) == 0)
     return;
 
-  scop_canonicalize_loops (scop);
   if (!scop_ivs_can_be_represented (scop))
     return;
 
-- 
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 09/12] Add testcase for PR42729 and fix handling of gimple_debug info 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 03/12] chrec_apply should only apply to the specified variable 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
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 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 11/12] Do not rewrite out of SSA scalar phi nodes that can be scev_analyzable_p Sebastian Pop
2010-07-16  7:05 ` Sebastian Pop [this message]
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 12/12] Unshare the scev before code generating it Sebastian Pop
2010-07-16  7:05 ` [PATCH 01/12] Remove insert_loop_close_phis 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-6-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).