OSDN Git Service

* emit-rtl.c (gen_reg_rtx): Also reallocate reg_decl array.
[pf3gnuchains/gcc-fork.git] / gcc / cfgcleanup.c
index a3ddcac..e6cf366 100644 (file)
@@ -106,14 +106,9 @@ try_simplify_condjump (cbranch_block)
   if (!can_fallthru (jump_block, cbranch_dest_block))
     return false;
 
-  /* Invert the conditional branch.  Prevent jump.c from deleting
-     "unreachable" instructions.  */
-  LABEL_NUSES (JUMP_LABEL (cbranch_insn))++;
-  if (!invert_jump (cbranch_insn, block_label (jump_dest_block), 1))
-    {
-      LABEL_NUSES (JUMP_LABEL (cbranch_insn))--;
-      return false;
-    }
+  /* Invert the conditional branch.  */
+  if (!invert_jump (cbranch_insn, block_label (jump_dest_block), 0))
+    return false;
 
   if (rtl_dump_file)
     fprintf (rtl_dump_file, "Simplifying condjump %i around jump %i\n",
@@ -319,8 +314,9 @@ static void
 merge_blocks_move_successor_nojumps (a, b)
      basic_block a, b;
 {
-  rtx barrier;
+  rtx barrier, real_b_end;
 
+  real_b_end = b->end;
   barrier = NEXT_INSN (b->end);
 
   /* Recognize a jump table following block B.  */
@@ -331,6 +327,8 @@ merge_blocks_move_successor_nojumps (a, b)
       && (GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_VEC
          || GET_CODE (PATTERN (NEXT_INSN (barrier))) == ADDR_DIFF_VEC))
     {
+      /* Temporarily add the table jump insn to b, so that it will also
+        be moved to the correct location.  */
       b->end = NEXT_INSN (barrier);
       barrier = NEXT_INSN (b->end);
     }
@@ -351,6 +349,9 @@ merge_blocks_move_successor_nojumps (a, b)
   /* Scramble the insn chain.  */
   reorder_insns_nobb (b->head, b->end, a->end);
 
+  /* Restore the real end of b.  */
+  b->end = real_b_end;
+
   /* Now blocks A and B are contiguous.  Merge them.  */
   merge_blocks_nomove (a, b);
 
@@ -915,7 +916,7 @@ try_crossjump_to_edge (mode, e1, e2)
     newpos1 = NEXT_INSN (newpos1);
   last = src1->end;
 
-  /* Emit the jump insn.   */
+  /* Emit the jump insn.  */
   label = block_label (redirect_to);
   emit_jump_insn_after (gen_jump (label), src1->end);
   JUMP_LABEL (src1->end) = label;
@@ -1048,6 +1049,9 @@ try_optimize_cfg (mode)
   bool changed;
   int iterations = 0;
 
+  if (mode & CLEANUP_CROSSJUMP)
+    add_noreturn_fake_exit_edges ();
+
   /* Attempt to merge blocks as made possible by edge removal.  If a block
      has only one successor, and the successor has only one predecessor,
      they may be combined.  */
@@ -1178,10 +1182,14 @@ try_optimize_cfg (mode)
       changed_overall |= changed;
     }
   while (changed);
+
+  if (mode & CLEANUP_CROSSJUMP)
+    remove_fake_edges ();
+
   return changed_overall;
 }
 \f
-/* Delete all unreachable basic blocks.   */
+/* Delete all unreachable basic blocks.  */
 
 static bool
 delete_unreachable_blocks ()