]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
emit-rtl.c (remove_insn): Do not call df_insn_delete here.
authorSteven Bosscher <steven@gcc.gnu.org>
Sat, 13 Apr 2013 10:04:09 +0000 (10:04 +0000)
committerSteven Bosscher <steven@gcc.gnu.org>
Sat, 13 Apr 2013 10:04:09 +0000 (10:04 +0000)
* emit-rtl.c (remove_insn): Do not call df_insn_delete here.
* cfgrtl.c (delete_insn): Call it here instead.
* lra-spills.c (lra_final_code_change): Use delete_insn.
* haifa-sched.c (sched_remove_insn): Likewise.
* sel-sched-ir.c (return_nop_to_pool): Clear INSN_DELETED_P for nops
returning to the nop pool.
(sel_remove_insn): Simplify the only_disconnect case via remove_insn,
use delete_insn for definitive removal.  Clear BLOCK_FOR_INSN.

From-SVN: r197942

gcc/ChangeLog
gcc/cfgrtl.c
gcc/emit-rtl.c
gcc/haifa-sched.c
gcc/lra-spills.c
gcc/sel-sched-ir.c

index 6ead79e8f8f0e8d71a8022b666ec1f57cfa1c5f1..f61412c5b69f09d6992d42e3d5d612195ef884dc 100644 (file)
@@ -1,3 +1,14 @@
+2013-04-13  Steven Bosscher  <steven@gcc.gnu.org>
+
+       * emit-rtl.c (remove_insn): Do not call df_insn_delete here.
+       * cfgrtl.c (delete_insn): Call it here instead.
+       * lra-spills.c (lra_final_code_change): Use delete_insn.
+       * haifa-sched.c (sched_remove_insn): Likewise.
+       * sel-sched-ir.c (return_nop_to_pool): Clear INSN_DELETED_P for nops
+       returning to the nop pool.
+       (sel_remove_insn): Simplify the only_disconnect case via remove_insn,
+       use delete_insn for definitive removal.  Clear BLOCK_FOR_INSN.
+
 2013-04-12  Steven Bosscher  <steven@gcc.gnu.org>
 
        * doc/tm.texi.in (LOOP_ALIGN): Remove loop note references.
index 6e8a31d95da21b8271d1f4d8d5faaefb5f019e4f..f59051daab5b2f3d280eead675463555209794b4 100644 (file)
@@ -164,6 +164,8 @@ delete_insn (rtx insn)
     {
       /* If this insn has already been deleted, something is very wrong.  */
       gcc_assert (!INSN_DELETED_P (insn));
+      if (INSN_P (insn))
+       df_insn_delete (insn);
       remove_insn (insn);
       INSN_DELETED_P (insn) = 1;
     }
index 73a59b58046213bd1f05e94a51b99008c8279417..82e476683ca4351a57637aa74ed384a0fdad2bf5 100644 (file)
@@ -3908,8 +3908,21 @@ set_insn_deleted (rtx insn)
 }
 
 
-/* Remove an insn from its doubly-linked list.  This function knows how
-   to handle sequences.  */
+/* Unlink INSN from the insn chain.
+
+   This function knows how to handle sequences.
+   
+   This function does not invalidate data flow information associated with
+   INSN (i.e. does not call df_insn_delete).  That makes this function
+   usable for only disconnecting an insn from the chain, and re-emit it
+   elsewhere later.
+
+   To later insert INSN elsewhere in the insn chain via add_insn and
+   similar functions, PREV_INSN and NEXT_INSN must be nullified by
+   the caller.  Nullifying them here breaks many insn chain walks.
+
+   To really delete an insn and related DF information, use delete_insn.  */
+
 void
 remove_insn (rtx insn)
 {
@@ -3968,10 +3981,6 @@ remove_insn (rtx insn)
       gcc_assert (stack);
     }
 
-  /* Invalidate data flow information associated with INSN.  */
-  if (INSN_P (insn))
-    df_insn_delete (insn);
-
   /* Fix up basic block boundaries, if necessary.  */
   if (!BARRIER_P (insn)
       && (bb = BLOCK_FOR_INSN (insn)))
index c4591bfe35b9d855309bda5c9a8780d5dd7b51a9..16094b231b2092ba7c9c0b6f358c57e1d94c67c8 100644 (file)
@@ -8198,7 +8198,7 @@ sched_remove_insn (rtx insn)
 
   change_queue_index (insn, QUEUE_NOWHERE);
   current_sched_info->add_remove_insn (insn, 1);
-  remove_insn (insn);
+  delete_insn (insn);
 }
 
 /* Clear priorities of all instructions, that are forward dependent on INSN.
index 163ca11509d6835674818fe81ada80e93ead4191..60e51eec0c52f45dc1ea68090ba91d556f4a2dae 100644 (file)
@@ -639,7 +639,7 @@ lra_final_code_change (void)
                 need them anymore and don't want to waste compiler
                 time processing them in a few subsequent passes.  */
              lra_invalidate_insn_data (insn);
-             remove_insn (insn);
+             delete_insn (insn);
              continue;
            }
 
index 91e91ec37fd6d574b648fca4d6a472cc06a4a04c..47e769534dbf5509b9e335a5ec9fa2dcb7edd85c 100644 (file)
@@ -1065,6 +1065,9 @@ return_nop_to_pool (insn_t nop, bool full_tidying)
   gcc_assert (INSN_IN_STREAM_P (nop));
   sel_remove_insn (nop, false, full_tidying);
 
+  /* We'll recycle this nop.  */
+  INSN_DELETED_P (nop) = 0;
+
   if (nop_pool.n == nop_pool.s)
     nop_pool.v = XRESIZEVEC (rtx, nop_pool.v,
                              (nop_pool.s = 2 * nop_pool.s + 1));
@@ -3929,31 +3932,19 @@ sel_remove_insn (insn_t insn, bool only_disconnect, bool full_tidying)
     }
 
   if (only_disconnect)
-    {
-      insn_t prev = PREV_INSN (insn);
-      insn_t next = NEXT_INSN (insn);
-      basic_block bb = BLOCK_FOR_INSN (insn);
-
-      NEXT_INSN (prev) = next;
-      PREV_INSN (next) = prev;
-
-      if (BB_HEAD (bb) == insn)
-        {
-          gcc_assert (BLOCK_FOR_INSN (prev) == bb);
-          BB_HEAD (bb) = prev;
-        }
-      if (BB_END (bb) == insn)
-        BB_END (bb) = prev;
-    }
+    remove_insn (insn);
   else
     {
-      remove_insn (insn);
+      delete_insn (insn);
       clear_expr (INSN_EXPR (insn));
     }
 
-  /* It is necessary to null this fields before calling add_insn ().  */
+  /* It is necessary to NULL these fields in case we are going to re-insert
+     INSN into the insns stream, as will usually happen in the ONLY_DISCONNECT
+     case, but also for NOPs that we will return to the nop pool.  */
   PREV_INSN (insn) = NULL_RTX;
   NEXT_INSN (insn) = NULL_RTX;
+  set_block_for_insn (insn, NULL);
 
   return tidy_control_flow (bb, full_tidying);
 }