cfgloopmanip.c (loopify): Take two more arguments true_edge and false_edge.
authorKazu Hirata <kazu@cs.umass.edu>
Mon, 25 Oct 2004 21:46:18 +0000 (21:46 +0000)
committerKazu Hirata <kazu@gcc.gnu.org>
Mon, 25 Oct 2004 21:46:18 +0000 (21:46 +0000)
* cfgloopmanip.c (loopify): Take two more arguments true_edge
and false_edge.
* cfgloop.h: Adjust the corresponding prototype.
* loop-unswitch.c (unswitch_loop): Adjust a call to loopify.
* tree-ssa-loop-manip.c (tree_ssa_loop_version): Likewise.

From-SVN: r89555

gcc/ChangeLog
gcc/cfgloop.h
gcc/cfgloopmanip.c
gcc/loop-unswitch.c
gcc/tree-ssa-loop-manip.c

index e8bdb1f97ffa0ef46be6912b5825e3ae9666c043..86c001e2f39a363ff890f4502191b6c495999f0c 100644 (file)
@@ -1,3 +1,11 @@
+2004-10-25  Kazu Hirata  <kazu@cs.umass.edu>
+
+       * cfgloopmanip.c (loopify): Take two more arguments true_edge
+       and false_edge.
+       * cfgloop.h: Adjust the corresponding prototype.
+       * loop-unswitch.c (unswitch_loop): Adjust a call to loopify.
+       * tree-ssa-loop-manip.c (tree_ssa_loop_version): Likewise.
+
 2004-10-25  Jakub Jelinek  <jakub@redhat.com>
 
        * dwarf2out.c (rtl_for_decl_location): Avoid segfault if
index 5de3f64b80baaae0c794cd3888841d5fb9422e38..96d865f1af694d2a36ce72f9f5ba8aa7d0b13622 100644 (file)
@@ -339,7 +339,8 @@ extern struct loop * duplicate_loop (struct loops *, struct loop *,
 extern int duplicate_loop_to_header_edge (struct loop *, edge, struct loops *,
                                          unsigned, sbitmap, edge, edge *,
                                          unsigned *, int);
-extern struct loop *loopify (struct loops *, edge, edge, basic_block, bool);
+extern struct loop *loopify (struct loops *, edge, edge,
+                            basic_block, edge, edge, bool);
 extern void unloop (struct loops *, struct loop *);
 extern bool remove_path (struct loops *, edge);
 extern edge split_loop_bb (basic_block, void *);
index 6d47756f5886c000b83efd399e18d6847aedd9b3..f3e8f183373a0d5c723dc44633487da480e3bf31 100644 (file)
@@ -482,13 +482,14 @@ scale_loop_frequencies (struct loop *loop, int num, int den)
    accordingly. Everything between them plus LATCH_EDGE destination must
    be dominated by HEADER_EDGE destination, and back-reachable from
    LATCH_EDGE source.  HEADER_EDGE is redirected to basic block SWITCH_BB,
-   FALLTHRU_EDGE (SWITCH_BB) to original destination of HEADER_EDGE and
-   BRANCH_EDGE (SWITCH_BB) to original destination of LATCH_EDGE.
+   FALSE_EDGE of SWITCH_BB to original destination of HEADER_EDGE and
+   TRUE_EDGE of SWITCH_BB to original destination of LATCH_EDGE.
    Returns newly created loop.  */
 
 struct loop *
 loopify (struct loops *loops, edge latch_edge, edge header_edge, 
-        basic_block switch_bb, bool redirect_all_edges)
+        basic_block switch_bb, edge true_edge, edge false_edge,
+        bool redirect_all_edges)
 {
   basic_block succ_bb = latch_edge->dest;
   basic_block pred_bb = header_edge->src;
@@ -514,14 +515,14 @@ loopify (struct loops *loops, edge latch_edge, edge header_edge,
 
   /* Redirect edges.  */
   loop_redirect_edge (latch_edge, loop->header);
-  loop_redirect_edge (BRANCH_EDGE (switch_bb), succ_bb);
+  loop_redirect_edge (true_edge, succ_bb);
 
   /* During loop versioning, one of the switch_bb edge is already properly
      set. Do not redirect it again unless redirect_all_edges is true.  */
   if (redirect_all_edges)
     {
       loop_redirect_edge (header_edge, switch_bb);
-      loop_redirect_edge (FALLTHRU_EDGE (switch_bb), loop->header); 
+      loop_redirect_edge (false_edge, loop->header); 
      
       /* Update dominators.  */
       set_immediate_dominator (CDI_DOMINATORS, switch_bb, pred_bb);
index 49608151ff75212201503c68a8e5ce474f56f045..d1d49b2a38f6455fe2b6f73df39cde5adf4cec3e 100644 (file)
@@ -474,7 +474,8 @@ unswitch_loop (struct loops *loops, struct loop *loop, basic_block unswitch_on,
 
   /* Loopify from the copy of LOOP body, constructing the new loop.  */
   nloop = loopify (loops, latch_edge,
-                  EDGE_PRED (loop->header->rbi->copy, 0), switch_bb, true);
+                  EDGE_PRED (loop->header->rbi->copy, 0), switch_bb,
+                  BRANCH_EDGE (switch_bb), FALLTHRU_EDGE (switch_bb), true);
 
   /* Remove branches that are now unreachable in new loops.  */
   remove_path (loops, true_edge);
index 2dff13d8d58143f47a7d7df3ae53035deaca60c7..dc4b1747ade7a83aa4d514a9ce60b0a5f52d5358 100644 (file)
@@ -785,7 +785,7 @@ struct loop *
 tree_ssa_loop_version (struct loops *loops, struct loop * loop, 
                       tree cond_expr, basic_block *condition_bb)
 {
-  edge entry, latch_edge, exit;
+  edge entry, latch_edge, exit, true_edge, false_edge;
   basic_block first_head, second_head;
   int irred_flag;
   struct loop *nloop;
@@ -819,10 +819,12 @@ tree_ssa_loop_version (struct loops *loops, struct loop * loop,
                                            cond_expr); 
 
   latch_edge = EDGE_SUCC (loop->latch->rbi->copy, 0);
+  
+  extract_true_false_edges_from_block (*condition_bb, &true_edge, &false_edge);
   nloop = loopify (loops, 
                   latch_edge,
                   EDGE_PRED (loop->header->rbi->copy, 0),
-                  *condition_bb,
+                  *condition_bb, true_edge, false_edge,
                   false /* Do not redirect all edges.  */);
 
   exit = loop->single_exit;
@@ -833,7 +835,8 @@ tree_ssa_loop_version (struct loops *loops, struct loop * loop,
   lv_update_pending_stmts (latch_edge);
 
   /* loopify redirected condition_bb's succ edge. Update its PENDING_STMTS.  */ 
-  lv_update_pending_stmts (FALLTHRU_EDGE (*condition_bb));
+  extract_true_false_edges_from_block (*condition_bb, &true_edge, &false_edge);
+  lv_update_pending_stmts (false_edge);
 
   /* Adjust irreducible flag.  */
   if (irred_flag)