OSDN Git Service

* fixinc/inclhack.def (alpha_pthread_gcc): New fix.
[pf3gnuchains/gcc-fork.git] / gcc / cfgloopmanip.c
index 6075b4c..ca50760 100644 (file)
@@ -169,7 +169,7 @@ fix_bb_placement (struct loops *loops, basic_block bb)
    his placement no longer has to be correct, and iteratively fix placement of
    its predecessors that may change if placement of FROM changed.  Also fix
    placement of subloops of FROM->loop_father, that might also be altered due
-   to this change; the condition for them is simmilar, except that instead of
+   to this change; the condition for them is similar, except that instead of
    successors we consider edges coming out of the loops.  */
 static void
 fix_bb_placements (struct loops *loops, basic_block from)
@@ -310,18 +310,22 @@ fix_irreducible_loops (basic_block from)
        }
 
       for (i = 0; i < n_edges; i++)
-       if (e->flags & EDGE_IRREDUCIBLE_LOOP)
-         {
-           if (!flow_bb_inside_loop_p (from->loop_father, e->dest))
-             continue;
+       {
+         e = edges[i];
 
-           e->flags &= ~EDGE_IRREDUCIBLE_LOOP;
-           if (TEST_BIT (on_stack, e->dest->index))
-             continue;
+         if (e->flags & EDGE_IRREDUCIBLE_LOOP)
+           {
+             if (!flow_bb_inside_loop_p (from->loop_father, e->dest))
+               continue;
 
-           SET_BIT (on_stack, e->dest->index);
-           stack[stack_top++] = e->dest;
-         }
+             e->flags &= ~EDGE_IRREDUCIBLE_LOOP;
+             if (TEST_BIT (on_stack, e->dest->index))
+               continue;
+
+             SET_BIT (on_stack, e->dest->index);
+             stack[stack_top++] = e->dest;
+           }
+       }
       free (edges);
     }
 
@@ -645,7 +649,7 @@ unloop (struct loops *loops, struct loop *loop)
 }
 
 /* Fix placement of LOOP inside loop tree, i.e. find the innermost superloop
-   FATHER of LOOP such that all of the edges comming out of LOOP belong to
+   FATHER of LOOP such that all of the edges coming out of LOOP belong to
    FATHER, and set it as outer loop of LOOP.  Return 1 if placement of
    LOOP changed.  */
 int
@@ -988,6 +992,27 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops,
       /* Copy bbs.  */
       copy_bbs (bbs, n, new_bbs, spec_edges, 2, new_spec_edges, loop, loops);
 
+      /* Note whether the blocks and edges belong to an irreducible loop.  */
+      if (add_irreducible_flag)
+       {
+         for (i = 0; i < n; i++)
+           new_bbs[i]->rbi->duplicated = 1;
+         for (i = 0; i < n; i++)
+           {
+             new_bb = new_bbs[i];
+             if (new_bb->loop_father == target)
+               new_bb->flags |= BB_IRREDUCIBLE_LOOP;
+
+             for (ae = new_bb->succ; ae; ae = ae->succ_next)
+               if (ae->dest->rbi->duplicated
+                   && (ae->src->loop_father == target
+                       || ae->dest->loop_father == target))
+                 ae->flags |= EDGE_IRREDUCIBLE_LOOP;
+           }
+         for (i = 0; i < n; i++)
+           new_bbs[i]->rbi->duplicated = 0;
+       }
+
       /* Redirect the special edges.  */
       if (is_latch)
        {
@@ -1011,22 +1036,6 @@ duplicate_loop_to_header_edge (struct loop *loop, edge e, struct loops *loops,
       if (orig && TEST_BIT (wont_exit, j + 1))
        to_remove[(*n_to_remove)++] = new_spec_edges[SE_ORIG];
 
-      /* Note whether the blocks and edges belong to an irreducible loop.  */
-      if (add_irreducible_flag)
-       {
-         for (i = 0; i < n; i++)
-           {
-             new_bb = new_bbs[i];
-             if (new_bb->loop_father == target)
-               new_bb->flags |= BB_IRREDUCIBLE_LOOP;
-
-             for (ae = new_bb->succ; ae; ae = ae->succ_next)
-               if (ae->src->loop_father == target
-                   || ae->dest->loop_father == target)
-                 ae->flags |= EDGE_IRREDUCIBLE_LOOP;
-           }
-       }
-
       /* Record the first copy in the control flow order if it is not
         the original loop (i.e. in case of peeling).  */
       if (!first_active_latch)