OSDN Git Service

Do not gather loop exit conditions on the basic blocks outside the loop.
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Jun 2010 22:09:35 +0000 (22:09 +0000)
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 9 Jun 2010 22:09:35 +0000 (22:09 +0000)
2010-06-09  Sebastian Pop  <sebastian.pop@amd.com>

* graphite-sese-to-poly.c (single_pred_cond): Renamed
single_pred_cond_non_loop_exit.  Return NULL for loop exit edges.
(build_sese_conditions_before): Renamed call to single_pred_cond.
(build_sese_conditions_after): Same.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@160509 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/graphite-sese-to-poly.c

index dddb0d6..111d1e5 100644 (file)
@@ -1,5 +1,12 @@
 2010-06-09  Sebastian Pop  <sebastian.pop@amd.com>
 
+       * graphite-sese-to-poly.c (single_pred_cond): Renamed
+       single_pred_cond_non_loop_exit.  Return NULL for loop exit edges.
+       (build_sese_conditions_before): Renamed call to single_pred_cond.
+       (build_sese_conditions_after): Same.
+
+2010-06-09  Sebastian Pop  <sebastian.pop@amd.com>
+
        * graphite-poly.h: Fix comments and indentation.
        * graphite-sese-to-poly.c: Same.
        (build_sese_conditions_before): Compute stmt and gbb only when needed.
index 617c57b..b73517d 100644 (file)
@@ -1379,21 +1379,28 @@ struct bsc
   sese region;
 };
 
-/* Returns non NULL when BB has a single predecessor and the last
-   statement of that predecessor is a COND_EXPR.  */
+/* Returns a COND_EXPR statement when BB has a single predecessor, the
+   edge between BB and its predecessor is not a loop exit edge, and
+   the last statement of the single predecessor is a COND_EXPR.  */
 
 static gimple
-single_pred_cond (basic_block bb)
+single_pred_cond_non_loop_exit (basic_block bb)
 {
   if (single_pred_p (bb))
     {
       edge e = single_pred_edge (bb);
       basic_block pred = e->src;
-      gimple stmt = last_stmt (pred);
+      gimple stmt;
+
+      if (loop_depth (pred->loop_father) > loop_depth (bb->loop_father))
+       return NULL;
+
+      stmt = last_stmt (pred);
 
       if (stmt && gimple_code (stmt) == GIMPLE_COND)
        return stmt;
     }
+
   return NULL;
 }
 
@@ -1413,7 +1420,7 @@ build_sese_conditions_before (struct dom_walk_data *dw_data,
   if (!bb_in_sese_p (bb, data->region))
     return;
 
-  stmt = single_pred_cond (bb);
+  stmt = single_pred_cond_non_loop_exit (bb);
 
   if (stmt)
     {
@@ -1450,7 +1457,7 @@ build_sese_conditions_after (struct dom_walk_data *dw_data,
   if (!bb_in_sese_p (bb, data->region))
     return;
 
-  if (single_pred_cond (bb))
+  if (single_pred_cond_non_loop_exit (bb))
     {
       VEC_pop (gimple, *conditions);
       VEC_pop (gimple, *cases);