loop.c (emit_prefetch_instructions): Properly place the address computation.
authorJan Hubicka <jh@suse.cz>
Sun, 2 Jun 2002 21:09:54 +0000 (23:09 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Sun, 2 Jun 2002 21:09:54 +0000 (21:09 +0000)
* loop.c (emit_prefetch_instructions): Properly place the address computation.

* basic-block.h (basic_block_for_insn, BLOCK_FOR_INSN): Kill.
(set_block_for_insn): Turn into macro.
* cfgbuild.c (find_basic_block): Do not clear basic_block_for_insn.
* cfglayout.c (insn_scopes): Kill.
(scope_to_insns_initialize): Do not use insn_scopes.
(scope_to_insns_finalize): Likewise.
(duplicate_insn_chain): Likewise.
(cfg_layout_initialize, cfg_layout_finalize): Do not turn scopes to notes.
* cfgrtl.c (basic_block_for_insn): Kill.
(delete_insn_and_edges, delete_insn_chain_and_edges): Simplify.
(create_basic_block_structure): Use reorder_insns.
(compute_bb_for_insn): Do not use basic_block_for_insn.
(merge_blocks_nomove): Likewise.
(update_bb_for_insn): Likewise.
(verify_flow_info): Likewise.
(set_block_for_insn): Kill.
* combine.c (try_combine): Update gen_rtx_INSN call.
* emit-rtl.c (gen_label_rtx): Update gen_rtx_CODE_LABEL call.
(mark_insn_raw, make_jump_insn_raw, make_call_insn_raw): Clear
scopes and BBs.
(add_insn_after, add_insn_before, remove_insn, reorder_insns): Simplify.
(emit_note_before, emit_note_after, emit_line_note_after, emit_note):
Clear BB.
(emit_insns_after): Simplify.
(emit_copy_of_insn_after): Copy scope.
* final.c (final_start_function): Lower scopes.
* flow.c (check_function_return_warnings): Do not rely on deleted insn.
* integrate.c (copy_insn_list): Cope scopes.
* jump.c (duplicate_loop_exit_test): LIkewise; simplify.
* loop.c (loop_optimize): Do not care block notes.
* print-rtl.c (print_rtx): Print BB.
* recog.c (apply_change_group): Simplify.
* rtl.c (copy_rtx): Handle 'B'.
* rtl.def (INSN, CALL_INSN, JUMP_INSN, NOTE): Add extra fields.
* rtl.h (Field accessors): Update indexes.
* sched-ebb.c (schedule_ebbs): Do not lower notes.
* sched-rgn.c (schedule_insns): Likewise.
* toplev.c (rest_of_compilation): Lower notes.
* unroll.c (unroll_loop): Do not care scoping notes.
(copy_loop_body): Copy scopes.

From-SVN: r54188

22 files changed:
gcc/ChangeLog
gcc/basic-block.h
gcc/cfgbuild.c
gcc/cfglayout.c
gcc/cfgrtl.c
gcc/combine.c
gcc/emit-rtl.c
gcc/final.c
gcc/flow.c
gcc/gcse.c
gcc/integrate.c
gcc/jump.c
gcc/loop.c
gcc/print-rtl.c
gcc/recog.c
gcc/rtl.c
gcc/rtl.def
gcc/rtl.h
gcc/sched-ebb.c
gcc/sched-rgn.c
gcc/toplev.c
gcc/unroll.c

index f931d52e98d35ad54e7bb6fd7fca587d7ceaf800..5243079f11f76a278660c4762974e8c9920fd902 100644 (file)
@@ -1,3 +1,50 @@
+Sun Jun  2 23:02:11 CEST 2002  Jan Hubicka  <jh@suse.cz>
+
+       * loop.c (emit_prefetch_instructions): Properly place the address computation.
+
+Sun Jun  2 22:56:48 CEST 2002  Jan Hubicka  <jh@suse.cz>
+
+       * basic-block.h (basic_block_for_insn, BLOCK_FOR_INSN): Kill.
+       (set_block_for_insn): Turn into macro.
+       * cfgbuild.c (find_basic_block): Do not clear basic_block_for_insn.
+       * cfglayout.c (insn_scopes): Kill.
+       (scope_to_insns_initialize): Do not use insn_scopes.
+       (scope_to_insns_finalize): Likewise.
+       (duplicate_insn_chain): Likewise.
+       (cfg_layout_initialize, cfg_layout_finalize): Do not turn scopes to notes.
+       * cfgrtl.c (basic_block_for_insn): Kill.
+       (delete_insn_and_edges, delete_insn_chain_and_edges): Simplify.
+       (create_basic_block_structure): Use reorder_insns.
+       (compute_bb_for_insn): Do not use basic_block_for_insn.
+       (merge_blocks_nomove): Likewise.
+       (update_bb_for_insn): Likewise.
+       (verify_flow_info): Likewise.
+       (set_block_for_insn): Kill.
+       * combine.c (try_combine): Update gen_rtx_INSN call.
+       * emit-rtl.c (gen_label_rtx): Update gen_rtx_CODE_LABEL call.
+       (mark_insn_raw, make_jump_insn_raw, make_call_insn_raw): Clear
+       scopes and BBs.
+       (add_insn_after, add_insn_before, remove_insn, reorder_insns): Simplify.
+       (emit_note_before, emit_note_after, emit_line_note_after, emit_note):
+       Clear BB.
+       (emit_insns_after): Simplify.
+       (emit_copy_of_insn_after): Copy scope.
+       * final.c (final_start_function): Lower scopes.
+       * flow.c (check_function_return_warnings): Do not rely on deleted insn.
+       * integrate.c (copy_insn_list): Cope scopes.
+       * jump.c (duplicate_loop_exit_test): LIkewise; simplify.
+       * loop.c (loop_optimize): Do not care block notes.
+       * print-rtl.c (print_rtx): Print BB.
+       * recog.c (apply_change_group): Simplify.
+       * rtl.c (copy_rtx): Handle 'B'.
+       * rtl.def (INSN, CALL_INSN, JUMP_INSN, NOTE): Add extra fields.
+       * rtl.h (Field accessors): Update indexes.
+       * sched-ebb.c (schedule_ebbs): Do not lower notes.
+       * sched-rgn.c (schedule_insns): Likewise.
+       * toplev.c (rest_of_compilation): Lower notes.
+       * unroll.c (unroll_loop): Do not care scoping notes.
+       (copy_loop_body): Copy scopes.
+
 2002-06-02  Neil Booth  <neil@daikokuya.demon.co.uk>
 
 config/h8300:
index 4fe64d44c92d2b7a74ae04e822dadf16259617d9..3f015a83434b40fbdb2ccfd3c12cbeac906e9dde 100644 (file)
@@ -303,14 +303,12 @@ extern struct basic_block_def entry_exit_blocks[2];
 #define ENTRY_BLOCK_PTR        (&entry_exit_blocks[0])
 #define EXIT_BLOCK_PTR (&entry_exit_blocks[1])
 
-extern varray_type basic_block_for_insn;
-#define BLOCK_FOR_INSN(INSN)  VARRAY_BB (basic_block_for_insn, INSN_UID (INSN))
 #define BLOCK_NUM(INSN)              (BLOCK_FOR_INSN (INSN)->index + 0)
+#define set_block_for_insn(INSN, BB)  (BLOCK_FOR_INSN (INSN) = BB)
 
 extern void compute_bb_for_insn                PARAMS ((int));
 extern void free_bb_for_insn           PARAMS ((void));
 extern void update_bb_for_insn         PARAMS ((basic_block));
-extern void set_block_for_insn         PARAMS ((rtx, basic_block));
 
 extern void free_basic_block_vars      PARAMS ((int));
 
index bdf175d53af9d7215b0d51385aa17e854862b24c..0352fbe52a039c227b46e655ed8c32c8b6348d27 100644 (file)
@@ -617,8 +617,6 @@ find_basic_blocks (f, nregs, file)
 
   timevar_push (TV_CFG);
 
-  basic_block_for_insn = 0;
-
   /* Flush out existing data.  */
   if (basic_block_info != NULL)
     {
index 494fa7c96eb8334f2ab48f60ecb29a1b46809b30..0c648b65f676ad3256dc013027670e47ac0a489b 100644 (file)
@@ -50,9 +50,6 @@ static void cleanup_unconditional_jumps       PARAMS ((void));
 static void fixup_fallthru_exit_predecessor PARAMS ((void));
 static rtx unlink_insn_chain PARAMS ((rtx, rtx));
 static rtx duplicate_insn_chain PARAMS ((rtx, rtx));
-
-/* Map insn uid to lexical block.  */
-static varray_type insn_scopes;
 \f
 static rtx
 unlink_insn_chain (first, last)
@@ -219,8 +216,6 @@ scope_to_insns_initialize ()
   tree block = NULL;
   rtx insn, next;
 
-  VARRAY_TREE_INIT (insn_scopes, get_max_uid (), "insn scopes");
-
   for (insn = get_insns (); insn; insn = next)
     {
       next = NEXT_INSN (insn);
@@ -228,7 +223,7 @@ scope_to_insns_initialize ()
       if (active_insn_p (insn)
          && GET_CODE (PATTERN (insn)) != ADDR_VEC
          && GET_CODE (PATTERN (insn)) != ADDR_DIFF_VEC)
-       VARRAY_TREE (insn_scopes, INSN_UID (insn)) = block;
+        INSN_SCOPE (insn) = block;
       else if (GET_CODE (insn) == NOTE)
        {
          switch (NOTE_LINE_NUMBER (insn))
@@ -324,13 +319,14 @@ scope_to_insns_finalize ()
      the common parent easily.  */
   set_block_levels (cur_block, 0);
 
-  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+  insn = get_insns ();
+  if (!active_insn_p (insn))
+    insn = next_active_insn (insn);
+  for (; insn; insn = next_active_insn (insn))
     {
       tree this_block;
 
-      if ((size_t) INSN_UID (insn) >= insn_scopes->num_elements)
-       continue;
-      this_block = VARRAY_TREE (insn_scopes, INSN_UID (insn));
+      this_block = INSN_SCOPE (insn);
       if (! this_block)
        continue;
 
@@ -341,8 +337,6 @@ scope_to_insns_finalize ()
        }
     }
 
-  VARRAY_FREE (insn_scopes);
-
   /* change_scope emits before the insn, not after.  */
   note = emit_note (NULL, NOTE_INSN_DELETED);
   change_scope (note, cur_block, DECL_INITIAL (cfun->decl));
@@ -742,10 +736,6 @@ duplicate_insn_chain (from, to)
              || GET_CODE (PATTERN (insn)) == ADDR_DIFF_VEC)
            break;
          new = emit_copy_of_insn_after (insn, get_last_insn ());
-         /* Record the INSN_SCOPE.  */
-         VARRAY_GROW (insn_scopes, INSN_UID (new) + 1);
-         VARRAY_TREE (insn_scopes, INSN_UID (new))
-           = VARRAY_TREE (insn_scopes, INSN_UID (insn));
          break;
 
        case CODE_LABEL:
@@ -958,8 +948,6 @@ cfg_layout_initialize ()
 
   cleanup_unconditional_jumps ();
 
-  scope_to_insns_initialize ();
-
   record_effective_endpoints ();
 }
 
@@ -976,8 +964,6 @@ cfg_layout_finalize ()
   verify_insn_chain ();
 #endif
 
-  scope_to_insns_finalize ();
-
   free_aux_for_blocks ();
 
 #ifdef ENABLE_CHECKING
index f721b12f916a7b643cfe31def0fe9e5e3e2dec5f..e40ecf23dea485daf1abb29b378a1b401f600277 100644 (file)
@@ -64,9 +64,6 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #define gen_return() NULL_RTX
 #endif
 
-/* The basic block structure for every insn, indexed by uid.  */
-varray_type basic_block_for_insn;
-
 /* The labels mentioned in non-jump rtl.  Valid during find_basic_blocks.  */
 /* ??? Should probably be using LABEL_NUSES instead.  It would take a
    bit of surgery to be able to use or co-opt the routines in jump.  */
@@ -187,9 +184,7 @@ delete_insn_and_edges (insn)
   rtx x;
   bool purge = false;
 
-  if (basic_block_for_insn
-      && INSN_P (insn)
-      && (unsigned int)INSN_UID (insn) < basic_block_for_insn->num_elements
+  if (INSN_P (insn)
       && BLOCK_FOR_INSN (insn)
       && BLOCK_FOR_INSN (insn)->end == insn)
     purge = true;
@@ -232,9 +227,7 @@ delete_insn_chain_and_edges (first, last)
 {
   bool purge = false;
 
-  if (basic_block_for_insn
-      && INSN_P (last)
-      && (unsigned int)INSN_UID (last) < basic_block_for_insn->num_elements
+  if (INSN_P (last)
       && BLOCK_FOR_INSN (last)
       && BLOCK_FOR_INSN (last)->end == last)
     purge = true;
@@ -277,7 +270,7 @@ create_basic_block_structure (index, head, end, bb_note, after)
        }
 
       if (after != bb_note && NEXT_INSN (after) != bb_note)
-       reorder_insns (bb_note, bb_note, after);
+       reorder_insns_nobb (bb_note, bb_note, after);
     }
   else
     {
@@ -315,8 +308,7 @@ create_basic_block_structure (index, head, end, bb_note, after)
   bb->flags = BB_NEW;
   link_block (bb, after);
   BASIC_BLOCK (index) = bb;
-  if (basic_block_for_insn)
-    update_bb_for_insn (bb);
+  update_bb_for_insn (bb);
 
   /* Tag the block so that we know it has been used when considering
      other basic block notes.  */
@@ -440,11 +432,6 @@ compute_bb_for_insn (max)
 {
   basic_block bb;
 
-  if (basic_block_for_insn)
-    VARRAY_FREE (basic_block_for_insn);
-
-  VARRAY_BB_INIT (basic_block_for_insn, max, "basic_block_for_insn");
-
   FOR_EACH_BB (bb)
     {
       rtx end = bb->end;
@@ -452,9 +439,7 @@ compute_bb_for_insn (max)
 
       for (insn = bb->head; ; insn = NEXT_INSN (insn))
        {
-         if (INSN_UID (insn) < max)
-           VARRAY_BB (basic_block_for_insn, INSN_UID (insn)) = bb;
-
+         BLOCK_FOR_INSN (insn) = bb;
          if (insn == end)
            break;
        }
@@ -466,10 +451,10 @@ compute_bb_for_insn (max)
 void
 free_bb_for_insn ()
 {
-  if (basic_block_for_insn)
-    VARRAY_FREE (basic_block_for_insn);
-
-  basic_block_for_insn = 0;
+  rtx insn;
+  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+    if (GET_CODE (insn) != BARRIER)
+      BLOCK_FOR_INSN (insn) = NULL;
 }
 
 /* Update insns block within BB.  */
@@ -480,9 +465,6 @@ update_bb_for_insn (bb)
 {
   rtx insn;
 
-  if (! basic_block_for_insn)
-    return;
-
   for (insn = bb->head; ; insn = NEXT_INSN (insn))
     {
       set_block_for_insn (insn, bb);
@@ -490,26 +472,6 @@ update_bb_for_insn (bb)
        break;
     }
 }
-
-/* Record INSN's block as BB.  */
-
-void
-set_block_for_insn (insn, bb)
-     rtx insn;
-     basic_block bb;
-{
-  size_t uid = INSN_UID (insn);
-
-  if (uid >= basic_block_for_insn->num_elements)
-    {
-      /* Add one-eighth the size so we don't keep calling xrealloc.  */
-      size_t new_size = uid + (uid + 7) / 8;
-
-      VARRAY_GROW (basic_block_for_insn, new_size);
-    }
-
-  VARRAY_BB (basic_block_for_insn, uid) = bb;
-}
 \f
 /* Split a block BB after insn INSN creating a new fallthru edge.
    Return the new edge.  Note that to keep other parts of the compiler happy,
@@ -668,15 +630,12 @@ merge_blocks_nomove (a, b)
   /* Reassociate the insns of B with A.  */
   if (!b_empty)
     {
-      if (basic_block_for_insn)
-       {
-         rtx x;
+      rtx x;
 
-         for (x = a_end; x != b_end; x = NEXT_INSN (x))
-           set_block_for_insn (x, a);
+      for (x = a_end; x != b_end; x = NEXT_INSN (x))
+       set_block_for_insn (x, a);
 
-         set_block_for_insn (b_end, a);
-       }
+      set_block_for_insn (b_end, a);
 
       a_end = b_end;
     }
@@ -697,8 +656,6 @@ block_label (block)
   if (GET_CODE (block->head) != CODE_LABEL)
     {
       block->head = emit_label_before (gen_label_rtx (), block->head);
-      if (basic_block_for_insn)
-       set_block_for_insn (block->head, block);
     }
 
   return block->head;
@@ -1972,7 +1929,7 @@ verify_flow_info ()
        }
 
       for (x = bb->head; x != NEXT_INSN (bb->end); x = NEXT_INSN (x))
-       if (basic_block_for_insn && BLOCK_FOR_INSN (x) != bb)
+       if (BLOCK_FOR_INSN (x) != bb)
          {
            debug_rtx (x);
            if (! BLOCK_FOR_INSN (x))
index f0e4431486960a3876a2573250c8088f6ebf48f2..fe247ea7dc2ae3fdcc2dde2713e9cb976eb53e58 100644 (file)
@@ -1755,6 +1755,7 @@ try_combine (i3, i2, i1, new_direct_jump_p)
 
          subst_prev_insn = i1
            = gen_rtx_INSN (VOIDmode, INSN_UID (i2), NULL_RTX, i2,
+                           BLOCK_FOR_INSN (i2), INSN_SCOPE (i2),
                            XVECEXP (PATTERN (i2), 0, 1), -1, NULL_RTX,
                            NULL_RTX);
 
index 8f8f701e17b7f446730f44d6b1eedf526e99b378..237f23d8642bfec0e6262ee1012f67195176407f 100644 (file)
@@ -2175,8 +2175,8 @@ gen_label_rtx ()
 {
   rtx label;
 
-  label = gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX,
-                             NULL_RTX, label_num++, NULL, NULL);
+  label = gen_rtx_CODE_LABEL (VOIDmode, 0, NULL_RTX, NULL_RTX,
+                             NULL, label_num++, NULL, NULL);
 
   LABEL_NUSES (label) = 0;
   LABEL_ALTERNATE_NAME (label) = NULL;
@@ -3253,6 +3253,8 @@ make_insn_raw (pattern)
   INSN_CODE (insn) = -1;
   LOG_LINKS (insn) = NULL;
   REG_NOTES (insn) = NULL;
+  INSN_SCOPE (insn) = NULL;
+  BLOCK_FOR_INSN (insn) = NULL;
 
 #ifdef ENABLE_RTL_CHECKING
   if (insn
@@ -3285,6 +3287,8 @@ make_jump_insn_raw (pattern)
   LOG_LINKS (insn) = NULL;
   REG_NOTES (insn) = NULL;
   JUMP_LABEL (insn) = NULL;
+  INSN_SCOPE (insn) = NULL;
+  BLOCK_FOR_INSN (insn) = NULL;
 
   return insn;
 }
@@ -3305,6 +3309,8 @@ make_call_insn_raw (pattern)
   LOG_LINKS (insn) = NULL;
   REG_NOTES (insn) = NULL;
   CALL_INSN_FUNCTION_USAGE (insn) = NULL;
+  INSN_SCOPE (insn) = NULL;
+  BLOCK_FOR_INSN (insn) = NULL;
 
   return insn;
 }
@@ -3369,8 +3375,8 @@ add_insn_after (insn, after)
        abort ();
     }
 
-  if (basic_block_for_insn
-      && (unsigned int) INSN_UID (after) < basic_block_for_insn->num_elements
+  if (GET_CODE (after) != BARRIER
+      && GET_CODE (insn) != BARRIER
       && (bb = BLOCK_FOR_INSN (after)))
     {
       set_block_for_insn (insn, bb);
@@ -3438,8 +3444,8 @@ add_insn_before (insn, before)
        abort ();
     }
 
-  if (basic_block_for_insn
-      && (unsigned int) INSN_UID (before) < basic_block_for_insn->num_elements
+  if (GET_CODE (before) != BARRIER
+      && GET_CODE (insn) != BARRIER
       && (bb = BLOCK_FOR_INSN (before)))
     {
       set_block_for_insn (insn, bb);
@@ -3518,8 +3524,7 @@ remove_insn (insn)
       if (stack == 0)
        abort ();
     }
-  if (basic_block_for_insn
-      && (unsigned int) INSN_UID (insn) < basic_block_for_insn->num_elements
+  if (GET_CODE (insn) != BARRIER
       && (bb = BLOCK_FOR_INSN (insn)))
     {
       if (INSN_P (insn))
@@ -3596,16 +3601,13 @@ reorder_insns (from, to, after)
 
   reorder_insns_nobb (from, to, after);
 
-  if (basic_block_for_insn
-      && (unsigned int) INSN_UID (after) < basic_block_for_insn->num_elements
+  if (GET_CODE (after) != BARRIER
       && (bb = BLOCK_FOR_INSN (after)))
     {
       rtx x;
       bb->flags |= BB_DIRTY;
 
-      if (basic_block_for_insn
-         && ((unsigned int) INSN_UID (from)
-             < basic_block_for_insn->num_elements)
+      if (GET_CODE (from) != BARRIER
          && (bb2 = BLOCK_FOR_INSN (from)))
        {
          if (bb2->end == to)
@@ -3913,6 +3915,7 @@ emit_note_before (subtype, before)
   INSN_UID (note) = cur_insn_uid++;
   NOTE_SOURCE_FILE (note) = 0;
   NOTE_LINE_NUMBER (note) = subtype;
+  BLOCK_FOR_INSN (note) = NULL;
 
   add_insn_before (note, before);
   return note;
@@ -4033,6 +4036,7 @@ emit_note_after (subtype, after)
   INSN_UID (note) = cur_insn_uid++;
   NOTE_SOURCE_FILE (note) = 0;
   NOTE_LINE_NUMBER (note) = subtype;
+  BLOCK_FOR_INSN (note) = NULL;
   add_insn_after (note, after);
   return note;
 }
@@ -4057,6 +4061,7 @@ emit_line_note_after (file, line, after)
   INSN_UID (note) = cur_insn_uid++;
   NOTE_SOURCE_FILE (note) = file;
   NOTE_LINE_NUMBER (note) = line;
+  BLOCK_FOR_INSN (note) = NULL;
   add_insn_after (note, after);
   return note;
 }
@@ -4152,14 +4157,15 @@ emit_insns_after (first, after)
   if (!first)
     return after;
 
-  if (basic_block_for_insn
-      && (unsigned int) INSN_UID (after) < basic_block_for_insn->num_elements
+  if (GET_CODE (after) != BARRIER
       && (bb = BLOCK_FOR_INSN (after)))
     {
       bb->flags |= BB_DIRTY;
       for (last = first; NEXT_INSN (last); last = NEXT_INSN (last))
-       set_block_for_insn (last, bb);
-      set_block_for_insn (last, bb);
+        if (GET_CODE (last) != BARRIER)
+         set_block_for_insn (last, bb);
+      if (GET_CODE (last) != BARRIER)
+        set_block_for_insn (last, bb);
       if (bb->end == after)
        bb->end = last;
     }
@@ -4295,6 +4301,7 @@ emit_note (file, line)
   INSN_UID (note) = cur_insn_uid++;
   NOTE_SOURCE_FILE (note) = file;
   NOTE_LINE_NUMBER (note) = line;
+  BLOCK_FOR_INSN (note) = NULL;
   add_insn (note);
   return note;
 }
@@ -5212,6 +5219,8 @@ emit_copy_of_insn_after (insn, after)
   /* Update LABEL_NUSES.  */
   mark_jump_label (PATTERN (new), new, 0);
 
+  INSN_SCOPE (new) = INSN_SCOPE (insn);
+
   /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will
      make them.  */
   for (link = REG_NOTES (insn); link; link = XEXP (link, 1))
index 25a4e84c423aa474ec640bb77982b22bda88859c..f58190a69589c009c7f84311962aef7d7d5b33b5 100644 (file)
@@ -69,6 +69,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
 #include "debug.h"
 #include "expr.h"
 #include "profile.h"
+#include "cfglayout.h"
 
 #ifdef XCOFF_DEBUGGING_INFO
 #include "xcoffout.h"          /* Needed for external data
@@ -1671,7 +1672,7 @@ final_start_function (first, file, optimize)
   if (write_symbols)
     {
       remove_unnecessary_notes ();
-      reorder_blocks ();
+      scope_to_insns_finalize ();
       number_blocks (current_function_decl);
       /* We never actually put out begin/end notes for the top-level
         block in the function.  But, conceptually, that block is
index 78cd43990aa9fb91ddf27f4fea8611b0d8c2f689..6c81d48d08b89ddb7fa7d25b039988edbca9f48d 100644 (file)
@@ -373,10 +373,14 @@ check_function_return_warnings ()
         is no longer in the chain.  */
       if (INSN_UID (cfun->x_clobber_return_insn) < max_uid)
        {
-         /* Recompute insn->block mapping, since the initial mapping is
-            set before we delete unreachable blocks.  */
-         if (BLOCK_FOR_INSN (cfun->x_clobber_return_insn) != NULL)
-           warning ("control reaches end of non-void function");
+         rtx insn;
+
+         for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
+           if (insn == cfun->x_clobber_return_insn)
+             {
+               warning ("control reaches end of non-void function");
+               break;
+             }
        }
     }
 }
index cd2481096afaa6c8adee7afb6d0ae2d294f1a912..19d46b1877d3dfaacc168938a6fc0836421457ea 100644 (file)
@@ -4541,10 +4541,10 @@ bypass_conditional_jumps ()
              {
                if (setcc)
                  break;
-               if (GET_CODE (PATTERN (setcc)) != SET)
+               if (GET_CODE (PATTERN (insn)) != SET)
                  break;
 
-               dest = SET_DEST (PATTERN (setcc));
+               dest = SET_DEST (PATTERN (insn));
                if (REG_P (dest) || CC0_P (dest))
                  setcc = insn;
                else
index cf9413ee5169d112098afa6e5a05216c24e2c481..6de4f22b7b524beaf1fdaf9763497a50365ed2e0 100644 (file)
@@ -1334,6 +1334,7 @@ copy_insn_list (insns, map, static_chain_value)
       switch (GET_CODE (insn))
        {
        case INSN:
+         INSN_SCOPE (copy) = INSN_SCOPE (insn);
          pattern = PATTERN (insn);
          set = single_set (insn);
          copy = 0;
@@ -1507,6 +1508,7 @@ copy_insn_list (insns, map, static_chain_value)
          break;
 
        case JUMP_INSN:
+         INSN_SCOPE (copy) = INSN_SCOPE (insn);
          if (map->integrating && returnjump_p (insn))
            {
              if (map->local_return_label == 0)
@@ -1553,6 +1555,7 @@ copy_insn_list (insns, map, static_chain_value)
          /* If this is a CALL_PLACEHOLDER insn then we need to copy the
             three attached sequences: normal call, sibling call and tail
             recursion.  */
+         INSN_SCOPE (copy) = INSN_SCOPE (insn);
          if (GET_CODE (PATTERN (insn)) == CALL_PLACEHOLDER)
            {
              rtx sequence[3];
index f32b831c6dfb1c22dca59559bd19f4c625e20762..0937336ba1ac994b929dc79082ed44ce1a39ad41 100644 (file)
@@ -305,8 +305,6 @@ duplicate_loop_exit_test (loop_start)
         is a CODE_LABEL
         has a REG_RETVAL or REG_LIBCALL note (hard to adjust)
         is a NOTE_INSN_LOOP_BEG because this means we have a nested loop
-        is a NOTE_INSN_BLOCK_{BEG,END} because duplicating these notes
-             is not valid.
 
      We also do not do this if we find an insn with ASM_OPERANDS.  While
      this restriction should not be necessary, copying an insn with
@@ -326,18 +324,6 @@ duplicate_loop_exit_test (loop_start)
        case CALL_INSN:
          return 0;
        case NOTE:
-         /* We could be in front of the wrong NOTE_INSN_LOOP_END if there is
-            a jump immediately after the loop start that branches outside
-            the loop but within an outer loop, near the exit test.
-            If we copied this exit test and created a phony
-            NOTE_INSN_LOOP_VTOP, this could make instructions immediately
-            before the exit test look like these could be safely moved
-            out of the loop even if they actually may be never executed.
-            This can be avoided by checking here for NOTE_INSN_LOOP_CONT.  */
-
-         if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_BEG
-             || NOTE_LINE_NUMBER (insn) == NOTE_INSN_LOOP_CONT)
-           return 0;
 
          if (optimize < 2
              && (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG
@@ -423,6 +409,7 @@ duplicate_loop_exit_test (loop_start)
            replace_regs (PATTERN (copy), reg_map, max_reg, 1);
 
          mark_jump_label (PATTERN (copy), copy, 0);
+         INSN_SCOPE (copy) = INSN_SCOPE (insn);
 
          /* Copy all REG_NOTES except REG_LABEL since mark_jump_label will
             make them.  */
@@ -448,6 +435,7 @@ duplicate_loop_exit_test (loop_start)
        case JUMP_INSN:
          copy = emit_jump_insn_before (copy_insn (PATTERN (insn)),
                                        loop_start);
+         INSN_SCOPE (copy) = INSN_SCOPE (insn);
          if (reg_map)
            replace_regs (PATTERN (copy), reg_map, max_reg, 1);
          mark_jump_label (PATTERN (copy), copy, 0);
index 20c5f1dab0ab4cf47df1c06db25a91566a457a77..bc75f8ba3b858e7d8737e44e9b44f88d0d2de4c7 100644 (file)
@@ -566,13 +566,6 @@ loop_optimize (f, dumpfile, flags)
        scan_loop (loop, flags);
     }
 
-  /* If there were lexical blocks inside the loop, they have been
-     replicated.  We will now have more than one NOTE_INSN_BLOCK_BEG
-     and NOTE_INSN_BLOCK_END for each such block.  We must duplicate
-     the BLOCKs as well.  */
-  if (write_symbols != NO_DEBUG)
-    reorder_blocks ();
-
   end_alias_analysis ();
 
   /* Clean up.  */
@@ -4139,6 +4132,7 @@ emit_prefetch_instructions (loop)
          int bytes_ahead = PREFETCH_BLOCK * (ahead + y);
          rtx before_insn = info[i].giv->insn;
          rtx prev_insn = PREV_INSN (info[i].giv->insn);
+         rtx seq;
 
          /* We can save some effort by offsetting the address on
             architectures with offsettable memory references.  */
@@ -4153,13 +4147,16 @@ emit_prefetch_instructions (loop)
              loc = reg;
            }
 
+         start_sequence ();
          /* Make sure the address operand is valid for prefetch.  */
          if (! (*insn_data[(int)CODE_FOR_prefetch].operand[0].predicate)
                  (loc, insn_data[(int)CODE_FOR_prefetch].operand[0].mode))
            loc = force_reg (Pmode, loc);
-         emit_insn_before (gen_prefetch (loc, GEN_INT (info[i].write),
-                                         GEN_INT (3)),
-                           before_insn);
+         emit_insn (gen_prefetch (loc, GEN_INT (info[i].write),
+                                  GEN_INT (3)));
+         seq = gen_sequence ();
+         end_sequence ();
+         emit_insn_before (seq, before_insn);
 
          /* Check all insns emitted and record the new GIV
             information.  */
index 823ffa0c5139d1f35066b96344859fcc356cb6b4..723fd0d3eb5e3945bbe342bc69cd25e82c26a8fd 100644 (file)
@@ -475,6 +475,11 @@ print_rtx (in_rtx)
        sawclose = 0;
        break;
 
+      case 'B':
+       if (XBBDEF (in_rtx, i))
+         fprintf (outfile, " %i", XBBDEF (in_rtx, i)->index);
+       break;
+
       default:
        fprintf (stderr,
                 "switch format wrong in rtl.print_rtx(). format was: %c.\n",
index 10287450e81d50371058f769c6d458ba084b063c..6ad82eeae1dfc6cdc652748a8845c6934c77b72f 100644 (file)
@@ -397,9 +397,6 @@ apply_change_group ()
       for (i = 0; i < num_changes; i++)
        if (changes[i].object
            && INSN_P (changes[i].object)
-           && basic_block_for_insn
-           && ((unsigned int)INSN_UID (changes[i].object)
-               < basic_block_for_insn->num_elements)
            && (bb = BLOCK_FOR_INSN (changes[i].object)))
          bb->flags |= BB_DIRTY;
 
index 13e7380369bc06dfd7a41df2aa7d151acd48466d..da753b58428cf37605567299da7f9068897ff971 100644 (file)
--- a/gcc/rtl.c
+++ b/gcc/rtl.c
@@ -369,6 +369,7 @@ copy_rtx (orig)
        case 'S':
        case 'T':
        case 'u':
+       case 'B':
        case '0':
          /* These are left unchanged.  */
          break;
index 71c2ef18ab1149e9db650d24da0ce02558cdcef2..270f1a842ac6c902f8a13704f01aa1f8043746d4 100644 (file)
@@ -545,37 +545,37 @@ DEF_RTL_EXPR (ATTR_FLAG, "attr_flag", "s", 'x')
    ---------------------------------------------------------------------- */
 
 /* An instruction that cannot jump.  */
-DEF_RTL_EXPR(INSN, "insn", "iuueiee", 'i')
+DEF_RTL_EXPR(INSN, "insn", "iuuBteiee", 'i')
 
 /* An instruction that can possibly jump.
    Fields ( rtx->fld[] ) have exact same meaning as INSN's.  */
-DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "iuueiee0", 'i')
+DEF_RTL_EXPR(JUMP_INSN, "jump_insn", "iuuBteiee0", 'i')
 
 /* An instruction that can possibly call a subroutine
    but which will not change which instruction comes next
    in the current function.
-   Field ( rtx->fld[7] ) is CALL_INSN_FUNCTION_USAGE.
+   Field ( rtx->fld[9] ) is CALL_INSN_FUNCTION_USAGE.
    All other fields ( rtx->fld[] ) have exact same meaning as INSN's.  */
-DEF_RTL_EXPR(CALL_INSN, "call_insn", "iuueieee", 'i')
+DEF_RTL_EXPR(CALL_INSN, "call_insn", "iuuBteieee", 'i')
 
 /* A marker that indicates that control will not flow through.  */
 DEF_RTL_EXPR(BARRIER, "barrier", "iuu", 'x')
 
 /* Holds a label that is followed by instructions.
    Operand:
-   3: is used in jump.c for the use-count of the label.
-   4: is used in flow.c to point to the chain of label_ref's to this label.
-   5: is a number that is unique in the entire compilation.
-   6: is the user-given name of the label, if any.
-   7: is the alternate label name.  */
-DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuu00iss", 'x')
+   4: is used in jump.c for the use-count of the label.
+   5: is used in flow.c to point to the chain of label_ref's to this label.
+   6: is a number that is unique in the entire compilation.
+   7: is the user-given name of the label, if any.
+   8: is the alternate label name.  */
+DEF_RTL_EXPR(CODE_LABEL, "code_label", "iuuB00iss", 'x')
      
 /* Say where in the code a source line starts, for symbol table's sake.
    Operand:
-   3: filename, if line number > 0, note-specific data otherwise.
-   4: line number if > 0, enum note_insn otherwise.
-   5: unique number if line number == note_insn_deleted_label.  */
-DEF_RTL_EXPR(NOTE, "note", "iuu0ni", 'x')
+   4: filename, if line number > 0, note-specific data otherwise.
+   5: line number if > 0, enum note_insn otherwise.
+   6: unique number if line number == note_insn_deleted_label.  */
+DEF_RTL_EXPR(NOTE, "note", "iuuB0ni", 'x')
 
 /* ----------------------------------------------------------------------
    Top level constituents of INSN, JUMP_INSN and CALL_INSN.
index b1218d0ef1c1151f04073e4e2a0976e9a6fc96cd..ff7f1c0d5aa3bafd5e9a0c9516ec57690d2f11a7 100644 (file)
--- a/gcc/rtl.h
+++ b/gcc/rtl.h
@@ -506,19 +506,21 @@ do {                              \
 #define PREV_INSN(INSN)        XEXP (INSN, 1)
 #define NEXT_INSN(INSN)        XEXP (INSN, 2)
 
+#define BLOCK_FOR_INSN(INSN) XBBDEF (INSN, 3)
+#define INSN_SCOPE(INSN) XTREE (INSN, 4)
 /* The body of an insn.  */
-#define PATTERN(INSN)  XEXP (INSN, 3)
+#define PATTERN(INSN)  XEXP (INSN, 5)
 
 /* Code number of instruction, from when it was recognized.
    -1 means this instruction has not been recognized yet.  */
-#define INSN_CODE(INSN) XINT (INSN, 4)
+#define INSN_CODE(INSN) XINT (INSN, 6)
 
 /* Set up in flow.c; empty before then.
    Holds a chain of INSN_LIST rtx's whose first operands point at
    previous insns with direct data-flow connections to this one.
    That means that those insns set variables whose next use is in this insn.
    They are always in the same basic block as this insn.  */
-#define LOG_LINKS(INSN)        XEXP(INSN, 5)
+#define LOG_LINKS(INSN)        XEXP(INSN, 7)
 
 #define RTX_INTEGRATED_P(RTX)                                          \
   (RTL_FLAG_CHECK8("RTX_INTEGRATED_P", (RTX), INSN, CALL_INSN,         \
@@ -570,7 +572,7 @@ do {                                \
    The mode field of the EXPR_LIST contains not a real machine mode
    but a value from enum reg_note.  */
 
-#define REG_NOTES(INSN)        XEXP(INSN, 6)
+#define REG_NOTES(INSN)        XEXP(INSN, 8)
 
 /* Don't forget to change reg_note_name in rtl.c.  */
 enum reg_note
@@ -739,12 +741,12 @@ extern const char * const reg_note_name[];
      CLOBBER expressions document the registers explicitly clobbered
    by this CALL_INSN.
      Pseudo registers can not be mentioned in this list.  */
-#define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 7)
+#define CALL_INSN_FUNCTION_USAGE(INSN) XEXP(INSN, 9)
 
 /* The label-number of a code-label.  The assembler label
    is made from `L' and the label-number printed in decimal.
    Label numbers are unique in a compilation.  */
-#define CODE_LABEL_NUMBER(INSN)        XINT (INSN, 5)
+#define CODE_LABEL_NUMBER(INSN)        XINT (INSN, 6)
 
 #define LINE_NUMBER NOTE
 
@@ -755,18 +757,18 @@ extern const char * const reg_note_name[];
    The NOTE_INSN_RANGE_{START,END} and NOTE_INSN_LIVE notes record their
    information as an rtx in the field.  */
 
-#define NOTE_SOURCE_FILE(INSN)         XCSTR (INSN, 3, NOTE)
-#define NOTE_BLOCK(INSN)       XCTREE (INSN, 3, NOTE)
-#define NOTE_EH_HANDLER(INSN)  XCINT (INSN, 3, NOTE)
-#define NOTE_RANGE_INFO(INSN)          XCEXP (INSN, 3, NOTE)
-#define NOTE_LIVE_INFO(INSN)           XCEXP (INSN, 3, NOTE)
-#define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 3, NOTE)
-#define NOTE_EXPECTED_VALUE(INSN) XCEXP (INSN, 3, NOTE)
-#define NOTE_PREDICTION(INSN)   XCINT (INSN, 3, NOTE)
+#define NOTE_SOURCE_FILE(INSN)         XCSTR (INSN, 4, NOTE)
+#define NOTE_BLOCK(INSN)       XCTREE (INSN, 4, NOTE)
+#define NOTE_EH_HANDLER(INSN)  XCINT (INSN, 4, NOTE)
+#define NOTE_RANGE_INFO(INSN)          XCEXP (INSN, 4, NOTE)
+#define NOTE_LIVE_INFO(INSN)           XCEXP (INSN, 4, NOTE)
+#define NOTE_BASIC_BLOCK(INSN) XCBBDEF (INSN, 4, NOTE)
+#define NOTE_EXPECTED_VALUE(INSN) XCEXP (INSN, 4, NOTE)
+#define NOTE_PREDICTION(INSN)   XCINT (INSN, 4, NOTE)
 
 /* In a NOTE that is a line number, this is the line number.
    Other kinds of NOTEs are identified by negative numbers here.  */
-#define NOTE_LINE_NUMBER(INSN) XCINT (INSN, 4, NOTE)
+#define NOTE_LINE_NUMBER(INSN) XCINT (INSN, 5, NOTE)
 
 /* Nonzero if INSN is a note marking the beginning of a basic block.  */
 #define NOTE_INSN_BASIC_BLOCK_P(INSN)                  \
@@ -774,8 +776,8 @@ extern const char * const reg_note_name[];
    && NOTE_LINE_NUMBER (INSN) == NOTE_INSN_BASIC_BLOCK)
 
 /* Algorithm and flags for prediction.  */
-#define NOTE_PREDICTION_ALG(INSN)   (XCINT(INSN, 3, NOTE)>>8)
-#define NOTE_PREDICTION_FLAGS(INSN) (XCINT(INSN, 3, NOTE)&0xff)
+#define NOTE_PREDICTION_ALG(INSN)   (XCINT(INSN, 4, NOTE)>>8)
+#define NOTE_PREDICTION_FLAGS(INSN) (XCINT(INSN, 4, NOTE)&0xff)
 #define NOTE_PREDICT(ALG,FLAGS)     ((ALG<<8)+(FLAGS))
 
 /* Codes that appear in the NOTE_LINE_NUMBER field
@@ -880,14 +882,14 @@ extern const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS];
 
 /* The name of a label, in case it corresponds to an explicit label
    in the input source code.  */
-#define LABEL_NAME(RTX) XCSTR (RTX, 6, CODE_LABEL)
+#define LABEL_NAME(RTX) XCSTR (RTX, 7, CODE_LABEL)
 
 /* In jump.c, each label contains a count of the number
    of LABEL_REFs that point at it, so unused labels can be deleted.  */
-#define LABEL_NUSES(RTX) XCINT (RTX, 3, CODE_LABEL)
+#define LABEL_NUSES(RTX) XCINT (RTX, 4, CODE_LABEL)
 
 /* Associate a name with a CODE_LABEL.  */
-#define LABEL_ALTERNATE_NAME(RTX) XCSTR (RTX, 7, CODE_LABEL)
+#define LABEL_ALTERNATE_NAME(RTX) XCSTR (RTX, 8, CODE_LABEL)
 
 /* The original regno this ADDRESSOF was built for.  */
 #define ADDRESSOF_REGNO(RTX) XCUINT (RTX, 1, ADDRESSOF)
@@ -898,13 +900,13 @@ extern const char * const note_insn_name[NOTE_INSN_MAX - NOTE_INSN_BIAS];
 /* In jump.c, each JUMP_INSN can point to a label that it can jump to,
    so that if the JUMP_INSN is deleted, the label's LABEL_NUSES can
    be decremented and possibly the label can be deleted.  */
-#define JUMP_LABEL(INSN)   XCEXP (INSN, 7, JUMP_INSN)
+#define JUMP_LABEL(INSN)   XCEXP (INSN, 9, JUMP_INSN)
 
 /* Once basic blocks are found in flow.c,
    each CODE_LABEL starts a chain that goes through
    all the LABEL_REFs that jump to that label.
    The chain eventually winds up at the CODE_LABEL: it is circular.  */
-#define LABEL_REFS(LABEL) XCEXP (LABEL, 4, CODE_LABEL)
+#define LABEL_REFS(LABEL) XCEXP (LABEL, 5, CODE_LABEL)
 \f
 /* This is the field in the LABEL_REF through which the circular chain
    of references to a particular label is linked.
index fd4556e5fe1fb94ab722ca834a12096eb5edb12b..91bf88ec2b999ef5dfa35021b42164277cfb9b06 100644 (file)
@@ -286,8 +286,6 @@ schedule_ebbs (dump_file)
   if (n_basic_blocks == 0)
     return;
 
-  scope_to_insns_initialize ();
-
   sched_init (dump_file);
 
   current_sched_info = &ebb_sched_info;
@@ -355,7 +353,5 @@ schedule_ebbs (dump_file)
   if (write_symbols != NO_DEBUG)
     rm_redundant_line_notes ();
 
-  scope_to_insns_finalize ();
-
   sched_finish ();
 }
index e2ea6b761173a6a8bbe8451d08cb399993126cbb..280f33089d6008d29200fa563c8f1dbf17595a4b 100644 (file)
@@ -2989,8 +2989,6 @@ schedule_insns (dump_file)
   if (n_basic_blocks == 0)
     return;
 
-  scope_to_insns_initialize ();
-
   nr_inter = 0;
   nr_spec = 0;
 
@@ -3079,8 +3077,6 @@ schedule_insns (dump_file)
   if (write_symbols != NO_DEBUG)
     rm_redundant_line_notes ();
 
-  scope_to_insns_finalize ();
-
   if (sched_verbose)
     {
       if (reload_completed == 0 && flag_schedule_interblock)
index b9432f44c357de9e02d3bff9f0129dbfbc978218..6eecb966138274d133a822b86976e09e2093687e 100644 (file)
@@ -2570,9 +2570,10 @@ rest_of_compilation (decl)
            && NOTE_LINE_NUMBER (insn) == NOTE_INSN_PREDICTION)
          delete_insn (insn);
     }
-   close_dump_file (DFI_sibling, print_rtl, get_insns ());
-   timevar_pop (TV_JUMP);
+  close_dump_file (DFI_sibling, print_rtl, get_insns ());
+  timevar_pop (TV_JUMP);
 
+  scope_to_insns_initialize ();
   /* Complete generation of exception handling code.  */
   find_exception_handler_labels ();
   if (doing_eh (0))
index ceec66ee0d3ce1af3808d5e4af6b933b32c60193..26fcaf7223fc7a95b0277c5793285f22052f19c2 100644 (file)
@@ -268,53 +268,6 @@ unroll_loop (loop, insn_count, strength_reduce_p)
       return;
     }
 
-  /* When emitting debugger info, we can't unroll loops with unequal numbers
-     of block_beg and block_end notes, because that would unbalance the block
-     structure of the function.  This can happen as a result of the
-     "if (foo) bar; else break;" optimization in jump.c.  */
-  /* ??? Gcc has a general policy that -g is never supposed to change the code
-     that the compiler emits, so we must disable this optimization always,
-     even if debug info is not being output.  This is rare, so this should
-     not be a significant performance problem.  */
-
-  if (1 /* write_symbols != NO_DEBUG */)
-    {
-      int block_begins = 0;
-      int block_ends = 0;
-
-      for (insn = loop_start; insn != loop_end; insn = NEXT_INSN (insn))
-       {
-         if (GET_CODE (insn) == NOTE)
-           {
-             if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_BEG)
-               block_begins++;
-             else if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_BLOCK_END)
-               block_ends++;
-             if (NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_BEG
-                 || NOTE_LINE_NUMBER (insn) == NOTE_INSN_EH_REGION_END)
-               {
-                 /* Note, would be nice to add code to unroll EH
-                    regions, but until that time, we punt (don't
-                    unroll).  For the proper way of doing it, see
-                    expand_inline_function.  */
-
-                 if (loop_dump_stream)
-                   fprintf (loop_dump_stream,
-                            "Unrolling failure: cannot unroll EH regions.\n");
-                 return;
-               }
-           }
-       }
-
-      if (block_begins != block_ends)
-       {
-         if (loop_dump_stream)
-           fprintf (loop_dump_stream,
-                    "Unrolling failure: Unbalanced block notes.\n");
-         return;
-       }
-    }
-
   /* Determine type of unroll to perform.  Depends on the number of iterations
      and the size of the loop.  */
 
@@ -2046,6 +1999,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration,
              copy = emit_insn (pattern);
            }
          REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
+         INSN_SCOPE (copy) = INSN_SCOPE (insn);
 
 #ifdef HAVE_cc0
          /* If this insn is setting CC0, it may need to look at
@@ -2092,6 +2046,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration,
          pattern = copy_rtx_and_substitute (PATTERN (insn), map, 0);
          copy = emit_jump_insn (pattern);
          REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
+         INSN_SCOPE (copy) = INSN_SCOPE (insn);
 
          if (JUMP_LABEL (insn))
            {
@@ -2215,6 +2170,7 @@ copy_loop_body (loop, copy_start, copy_end, map, exit_label, last_iteration,
          pattern = copy_rtx_and_substitute (PATTERN (insn), map, 0);
          copy = emit_call_insn (pattern);
          REG_NOTES (copy) = initial_reg_note_copy (REG_NOTES (insn), map);
+         INSN_SCOPE (copy) = INSN_SCOPE (insn);
          SIBLING_CALL_P (copy) = SIBLING_CALL_P (insn);
 
          /* Because the USAGE information potentially contains objects other