public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Sebastian Pop <spop@codeaurora.org>
To: gcc-patches@gcc.gnu.org
Cc: hiraditya@msn.com,	sebpop@gmail.com,	richard.guenther@gmail.com,
	Sebastian Pop <s.pop@samsung.com>
Subject: [PATCH 08/15] record loops in execution order
Date: Fri, 15 Jan 2016 17:15:00 -0000	[thread overview]
Message-ID: <1452878086-19297-8-git-send-email-sebpop@gmail.com> (raw)
In-Reply-To: <1452878086-19297-1-git-send-email-sebpop@gmail.com>

From: Sebastian Pop <s.pop@samsung.com>

	* graphite-scop-detection.c (record_loop_in_sese): New.
	(gather_bbs::before_dom_children): Call record_loop_in_sese.
	(build_scops): Remove call to build_sese_loop_nests.
	* sese.c (sese_record_loop): Remove.
	(build_sese_loop_nests): Remove.
	(new_sese_info): Remove region->loops.
	(free_sese_info): Same.
	* sese.h (sese_contains_loop): Same.
	(build_sese_loop_nests): Remove.
	(sese_contains_loop): Remove.
---
 gcc/graphite-scop-detection.c | 29 ++++++++++++++++++++---
 gcc/sese.c                    | 54 -------------------------------------------
 gcc/sese.h                    | 10 --------
 3 files changed, 26 insertions(+), 67 deletions(-)

diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index e004185..be33be3 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -1874,15 +1874,40 @@ gather_bbs::gather_bbs (cdi_direction direction, scop_p scop)
 {
 }
 
+/* Record in execution order the loops fully contained in the region.  */
+
+static void
+record_loop_in_sese (basic_block bb, sese_info_p region)
+{
+  loop_p father = bb->loop_father;
+  if (loop_in_sese_p (father, region->region))
+    {
+      bool found = false;
+      loop_p loop0;
+      int j;
+      FOR_EACH_VEC_ELT (region->loop_nest, j, loop0)
+	if (father == loop0)
+	  {
+	    found = true;
+	    break;
+	  }
+      if (!found)
+	region->loop_nest.safe_push (father);
+    }
+}
+
 /* Call-back for dom_walk executed before visiting the dominated
    blocks.  */
 
 edge
 gather_bbs::before_dom_children (basic_block bb)
 {
-  if (!bb_in_sese_p (bb, scop->scop_info->region))
+  sese_info_p region = scop->scop_info;
+  if (!bb_in_sese_p (bb, region->region))
     return NULL;
 
+  record_loop_in_sese (bb, region);
+  
   gcond *stmt = single_pred_cond_non_loop_exit (bb);
 
   if (stmt)
@@ -1991,8 +2016,6 @@ build_scops (vec<scop_p> *scops)
 	  continue;
 	}
 
-      build_sese_loop_nests (scop->scop_info);
-
       find_scop_parameters (scop);
       graphite_dim_t max_dim = PARAM_VALUE (PARAM_GRAPHITE_MAX_NB_SCOP_PARAMS);
 
diff --git a/gcc/sese.c b/gcc/sese.c
index b0f54de..2ecff7d 100644
--- a/gcc/sese.c
+++ b/gcc/sese.c
@@ -43,56 +43,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "sese.h"
 #include "tree-ssa-propagate.h"
 
-/* Record LOOP as occurring in REGION.  */
-
-static void
-sese_record_loop (sese_info_p region, loop_p loop)
-{
-  if (sese_contains_loop (region, loop))
-    return;
-
-  bitmap_set_bit (region->loops, loop->num);
-  region->loop_nest.safe_push (loop);
-}
-
-/* Build the loop nests contained in REGION.  Returns true when the
-   operation was successful.  */
-
-void
-build_sese_loop_nests (sese_info_p region)
-{
-  unsigned i;
-  basic_block bb;
-  struct loop *loop0, *loop1;
-
-  FOR_EACH_BB_FN (bb, cfun)
-    if (bb_in_sese_p (bb, region->region))
-      {
-	struct loop *loop = bb->loop_father;
-
-	/* Only add loops if they are completely contained in the SCoP.  */
-	if (loop->header == bb
-	    && bb_in_sese_p (loop->latch, region->region))
-	  sese_record_loop (region, loop);
-      }
-
-  /* Make sure that the loops in the SESE_LOOP_NEST are ordered.  It
-     can be the case that an inner loop is inserted before an outer
-     loop.  To avoid this, semi-sort once.  */
-  FOR_EACH_VEC_ELT (region->loop_nest, i, loop0)
-    {
-      if (region->loop_nest.length () == i + 1)
-	break;
-
-      loop1 = region->loop_nest[i + 1];
-      if (loop0->num > loop1->num)
-	{
-	  region->loop_nest[i] = loop1;
-	  region->loop_nest[i + 1] = loop0;
-	}
-    }
-}
-
 /* For a USE in BB, if BB is outside REGION, mark the USE in the
    LIVEOUTS set.  */
 
@@ -228,7 +178,6 @@ new_sese_info (edge entry, edge exit)
 
   region->region.entry = entry;
   region->region.exit = exit;
-  region->loops = BITMAP_ALLOC (NULL);
   region->loop_nest.create (3);
   region->params.create (3);
   region->rename_map = new rename_map_t;
@@ -244,9 +193,6 @@ new_sese_info (edge entry, edge exit)
 void
 free_sese_info (sese_info_p region)
 {
-  if (region->loops)
-    region->loops = BITMAP_ALLOC (NULL);
-
   region->params.release ();
   region->loop_nest.release ();
 
diff --git a/gcc/sese.h b/gcc/sese.h
index 99df354..f481524 100644
--- a/gcc/sese.h
+++ b/gcc/sese.h
@@ -86,7 +86,6 @@ typedef struct sese_info_t
   rename_map_t *rename_map;
 
   /* Loops completely contained in this SESE.  */
-  bitmap loops;
   vec<loop_p> loop_nest;
 
   /* Basic blocks contained in this SESE.  */
@@ -107,20 +106,11 @@ typedef struct sese_info_t
 extern sese_info_p new_sese_info (edge, edge);
 extern void free_sese_info (sese_info_p);
 extern void sese_insert_phis_for_liveouts (sese_info_p, basic_block, edge, edge);
-extern void build_sese_loop_nests (sese_info_p);
 extern struct loop *outermost_loop_in_sese (sese_l &, basic_block);
 extern tree scalar_evolution_in_region (const sese_l &, loop_p, tree);
 extern bool scev_analyzable_p (tree, sese_l &);
 extern bool invariant_in_sese_p_rec (tree, const sese_l &, bool *);
 
-/* Check that SESE contains LOOP.  */
-
-static inline bool
-sese_contains_loop (sese_info_p sese, struct loop *loop)
-{
-  return bitmap_bit_p (sese->loops, loop->num);
-}
-
 /* The number of parameters in REGION. */
 
 static inline unsigned
-- 
2.5.0

  parent reply	other threads:[~2016-01-15 17:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-15 17:14 [PATCH 01/15] add more coalescing to simplify constraints Sebastian Pop
2016-01-15 17:15 ` [PATCH 03/15] fix PR68343: disable graphite tests for isl 0.14 or earlier Sebastian Pop
2016-01-15 17:15 ` [PATCH 13/15] reinstantiate loop blocking Sebastian Pop
2016-01-15 17:15 ` [PATCH 09/15] fix memory leak in scop-detection Sebastian Pop
2016-01-15 17:15 ` Sebastian Pop [this message]
2016-01-15 17:15 ` [PATCH 04/15] add missing ast node for isl 0.15 Sebastian Pop
2016-01-15 17:15 ` [PATCH 05/15] remove tiling Sebastian Pop
2016-01-15 17:15 ` [PATCH 02/15] remove unused variable Sebastian Pop
2016-01-15 17:15 ` [PATCH 11/15] check for unstructured control flow Sebastian Pop
2016-01-15 17:15 ` [PATCH 07/15] check that all loops are valid in the combined region Sebastian Pop
2016-01-15 17:15 ` [PATCH 06/15] fix codegen error exposed by compute isl flow patch Sebastian Pop
2016-01-15 17:15 ` [PATCH 10/15] rewrite computation of iteration domains Sebastian Pop
2016-01-15 17:16 ` [PATCH 12/15] new scop schedule Sebastian Pop
2016-01-21 14:22 ` [PATCH 01/15] add more coalescing to simplify constraints Matthew Wahab
2016-01-21 14:33   ` Matthew Wahab

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=1452878086-19297-8-git-send-email-sebpop@gmail.com \
    --to=spop@codeaurora.org \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hiraditya@msn.com \
    --cc=richard.guenther@gmail.com \
    --cc=s.pop@samsung.com \
    --cc=sebpop@gmail.com \
    /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).