* basic-block.h (purge_all_dead_edges): Add update_life_p argument.
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Oct 2001 11:45:45 +0000 (11:45 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 29 Oct 2001 11:45:45 +0000 (11:45 +0000)
* cfgcleanup.c (merge_blocks): Update the life flag after merging;
fix warning.
* cfgrtl.c (purge_all_dead_edges): Allow updating of liveness.
(life_analysis): call purge_all_dead_edges after deleting noops.
(delete_noop_move): Do not purge CFG.
* toplev.c (rest_of_compilation): Update purge_all_dead_edges call.

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

gcc/ChangeLog
gcc/basic-block.h
gcc/cfgcleanup.c
gcc/cfgrtl.c
gcc/flow.c
gcc/toplev.c

index a97d1d2..2dd564a 100644 (file)
@@ -1,3 +1,13 @@
+Mon Oct 29 12:43:06 CET 2001  Jan Hubicka  <jh@suse.cz>
+
+       * basic-block.h (purge_all_dead_edges): Add update_life_p argument.
+       * cfgcleanup.c (merge_blocks): Update the life flag after merging;
+       fix warning.
+       * cfgrtl.c (purge_all_dead_edges): Allow updating of liveness.
+       (life_analysis): call purge_all_dead_edges after deleting noops.
+       (delete_noop_move): Do not purge CFG.
+       * toplev.c (rest_of_compilation): Update purge_all_dead_edges call.
+
 2001-10-28  David Edelsohn  <edelsohn@gnu.org>
 
        * config/rs6000/aix31.h (ASM_OUTPUT_EXTERNAL): Use assemble_name.
index 6430230..4eba1e4 100644 (file)
@@ -638,7 +638,7 @@ extern basic_block force_nonfallthru        PARAMS ((edge));
 extern bool redirect_edge_and_branch   PARAMS ((edge, basic_block));
 extern rtx block_label                 PARAMS ((basic_block));
 extern bool forwarder_block_p          PARAMS ((basic_block));
-extern bool purge_all_dead_edges       PARAMS ((void));
+extern bool purge_all_dead_edges       PARAMS ((bool));
 extern bool purge_dead_edges           PARAMS ((basic_block));
 extern void find_sub_basic_blocks      PARAMS ((basic_block));
 extern void find_many_sub_basic_blocks PARAMS ((sbitmap));
index bd5a3ed..6919e0f 100644 (file)
@@ -433,6 +433,12 @@ merge_blocks (e, b, c, mode)
   /* If B has a fallthru edge to C, no need to move anything.  */
   if (e->flags & EDGE_FALLTHRU)
     {
+      /* We need to update liveness in case C already has broken liveness
+        or B ends by conditional jump to next instructions that will be
+        removed.  */
+      if ((BB_FLAGS (c) & BB_UPDATE_LIFE)
+         || GET_CODE (b->end) == JUMP_INSN)
+       BB_SET_FLAG (b, BB_UPDATE_LIFE);
       merge_blocks_nomove (b, c);
       update_forwarder_flag (b);
 
@@ -490,7 +496,7 @@ merge_blocks (e, b, c, mode)
 
       if (b_has_incoming_fallthru)
        {
-         rtx bb;
+         basic_block bb;
          if (b_fallthru_edge->src == ENTRY_BLOCK_PTR)
            return false;
          bb = force_nonfallthru (b_fallthru_edge);
index 6abac76..16fca39 100644 (file)
@@ -1923,10 +1923,30 @@ purge_dead_edges (bb)
  */
 
 bool
-purge_all_dead_edges ()
+purge_all_dead_edges (update_life_p)
+     bool update_life_p;
 {
   int i, purged = false;
+  sbitmap blocks;
+
+  if (update_life_p)
+    {
+      blocks = sbitmap_alloc (n_basic_blocks);
+      sbitmap_zero (blocks);
+    }
   for (i = 0; i < n_basic_blocks; i++)
-    purged |= purge_dead_edges (BASIC_BLOCK (i));
+    {
+      bool purged_here;
+      purged_here = purge_dead_edges (BASIC_BLOCK (i));
+      purged |= purged_here;
+      if (purged_here && update_life_p)
+       SET_BIT (blocks, i);
+    }
+  if (update_life_p && purged)
+    update_life_info (blocks, UPDATE_LIFE_GLOBAL,
+                     PROP_DEATH_NOTES | PROP_SCAN_DEAD_CODE
+                     | PROP_KILL_DEAD_CODE);
+  if (update_life_p)
+    sbitmap_free (blocks);
   return purged;
 }
index a58cf51..50e7494 100644 (file)
@@ -456,6 +456,7 @@ life_analysis (f, file, flags)
   /* Always remove no-op moves.  Do this before other processing so
      that we don't have to keep re-scanning them.  */
   delete_noop_moves (f);
+  purge_all_dead_edges (false);
 
   /* Some targets can emit simpler epilogues if they know that sp was
      not ever modified during the function.  After reload, of course,
@@ -803,8 +804,6 @@ delete_noop_moves (f)
              PUT_CODE (insn, NOTE);
              NOTE_LINE_NUMBER (insn) = NOTE_INSN_DELETED;
              NOTE_SOURCE_FILE (insn) = 0;
-             if (insn == bb->end)
-               purge_dead_edges (bb);
            }
        }
     }
index cd7fc11..e8184aa 100644 (file)
@@ -3301,7 +3301,7 @@ rest_of_compilation (decl)
 
       /* Always purge dead edges, as we may eliminate an insn throwing
          exception.  */
-      rebuild_jump_labels_after_combine |= purge_all_dead_edges ();
+      rebuild_jump_labels_after_combine |= purge_all_dead_edges (true);
 
       /* Combining insns may have turned an indirect jump into a
         direct jump.  Rebuid the JUMP_LABEL fields of jumping