diff mbox

[4/5] Add loop_exits_from_bb_p.

Message ID 1279657422-17300-4-git-send-email-sebpop@gmail.com
State New
Headers show

Commit Message

Sebastian Pop July 20, 2010, 8:23 p.m. UTC
2010-07-20  Vladimir Kargov  <kargov@gmail.com>
	    Sebastian Pop  <sebastian.pop@amd.com>

	* cfgloop.c (is_loop_exit): Renamed loop_exits_to_bb_p.
	(loop_exits_from_bb_p): New.
	* cfgloop.h (is_loop_exit): Renamed loop_exits_to_bb_p.
	(loop_exits_from_bb_p): Declared.
	* graphite-scop-detection.c (scopdet_basic_block_info): Call
	loop_exits_to_bb_p.
---
 gcc/ChangeLog.graphite        |   10 ++++++++++
 gcc/cfgloop.c                 |   19 +++++++++++++++++--
 gcc/cfgloop.h                 |    3 ++-
 gcc/graphite-scop-detection.c |    2 +-
 4 files changed, 30 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/gcc/ChangeLog.graphite b/gcc/ChangeLog.graphite
index 58ab265..8a2eced 100644
--- a/gcc/ChangeLog.graphite
+++ b/gcc/ChangeLog.graphite
@@ -1,4 +1,14 @@ 
 2010-07-20  Vladimir Kargov  <kargov@gmail.com>
+	    Sebastian Pop  <sebastian.pop@amd.com>
+
+	* cfgloop.c (is_loop_exit): Renamed loop_exits_to_bb_p.
+	(loop_exits_from_bb_p): New.
+	* cfgloop.h (is_loop_exit): Renamed loop_exits_to_bb_p.
+	(loop_exits_from_bb_p): Declared.
+	* graphite-scop-detection.c (scopdet_basic_block_info): Call
+	loop_exits_to_bb_p.
+
+2010-07-20  Vladimir Kargov  <kargov@gmail.com>
 
 	* refined-regions.c: Include tree-pass.h, cfgloop.h, gimple.h, and
 	tree-data-ref.h.
diff --git a/gcc/cfgloop.c b/gcc/cfgloop.c
index 0a8ceba..3657174 100644
--- a/gcc/cfgloop.c
+++ b/gcc/cfgloop.c
@@ -1622,10 +1622,10 @@  single_exit (const struct loop *loop)
     return NULL;
 }
 
-/* Returns true when BB has an edge exiting LOOP.  */
+/* Returns true when BB has an incoming edge exiting LOOP.  */
 
 bool
-is_loop_exit (struct loop *loop, basic_block bb)
+loop_exits_to_bb_p (struct loop *loop, basic_block bb)
 {
   edge e;
   edge_iterator ei;
@@ -1636,3 +1636,18 @@  is_loop_exit (struct loop *loop, basic_block bb)
 
   return false;
 }
+
+/* Returns true when BB has an outgoing edge exiting LOOP.  */
+
+bool
+loop_exits_from_bb_p (struct loop *loop, basic_block bb)
+{
+  edge e;
+  edge_iterator ei;
+
+  FOR_EACH_EDGE (e, ei, bb->succs)
+    if (loop_exit_edge_p (loop, e))
+      return true;
+
+  return false;
+}
diff --git a/gcc/cfgloop.h b/gcc/cfgloop.h
index 4d16a23..fdc71fb 100644
--- a/gcc/cfgloop.h
+++ b/gcc/cfgloop.h
@@ -232,7 +232,8 @@  extern int num_loop_insns (const struct loop *);
 extern int average_num_loop_insns (const struct loop *);
 extern unsigned get_loop_level (const struct loop *);
 extern bool loop_exit_edge_p (const struct loop *, const_edge);
-extern bool is_loop_exit (struct loop *, basic_block);
+extern bool loop_exits_to_bb_p (struct loop *, basic_block);
+extern bool loop_exits_from_bb_p (struct loop *, basic_block);
 extern void mark_loop_exit_edges (void);
 
 /* Loops & cfg manipulation.  */
diff --git a/gcc/graphite-scop-detection.c b/gcc/graphite-scop-detection.c
index 5d759be..b53b24b 100644
--- a/gcc/graphite-scop-detection.c
+++ b/gcc/graphite-scop-detection.c
@@ -595,7 +595,7 @@  scopdet_basic_block_info (basic_block bb, loop_p outermost_loop,
 	  {
 	    /* Ignore loop exits.  They will be handled after the loop
 	       body.  */
-	    if (is_loop_exit (loop, e->dest))
+	    if (loop_exits_to_bb_p (loop, e->dest))
 	      {
 		result.exits = true;
 		continue;