re PR middle-end/21460 (sjlj_emit_function_enter adds rtl to wrong block)
authorAlan Modra <amodra@bigpond.net.au>
Tue, 6 Sep 2005 04:53:53 +0000 (04:53 +0000)
committerAlan Modra <amodra@gcc.gnu.org>
Tue, 6 Sep 2005 04:53:53 +0000 (14:23 +0930)
PR middle-end/21460
* except.c (sjlj_emit_function_enter): Find the function begin
note even when it's not in first basic block.

From-SVN: r103930

gcc/ChangeLog
gcc/except.c

index 4d135ad5a0f58070d2562433c2e82b6696206ea1..88efaafa90d8ad28e7f533a7f58aa5ec89a163ec 100644 (file)
@@ -1,3 +1,9 @@
+2005-09-06  Alan Modra  <amodra@bigpond.net.au>
+
+       PR middle-end/21460
+       * except.c (sjlj_emit_function_enter): Find the function begin
+       note even when it's not in first basic block.
+
 2005-09-06  Kelley Cook  <kcook@gcc.gnu.org>
 
        * acinclude.m4: Renamed from aclocal.m4.  Delete AM_LANGINFO_CODESET,
index df91a1b2b186c32755aa0c790ea66a726438836e..91c917069ece0b1479cd5bbbb262af1b5fc8c0d4 100644 (file)
@@ -1728,6 +1728,7 @@ static void
 sjlj_emit_function_enter (rtx dispatch_label)
 {
   rtx fn_begin, fc, mem, seq;
+  bool fn_begin_outside_block;
 
   fc = cfun->eh->sjlj_fc;
 
@@ -1783,23 +1784,20 @@ sjlj_emit_function_enter (rtx dispatch_label)
      do this in a block that is at loop level 0 and dominates all
      can_throw_internal instructions.  */
 
+  fn_begin_outside_block = true;
   for (fn_begin = get_insns (); ; fn_begin = NEXT_INSN (fn_begin))
-    if (NOTE_P (fn_begin)
-       && (NOTE_LINE_NUMBER (fn_begin) == NOTE_INSN_FUNCTION_BEG
-           || NOTE_LINE_NUMBER (fn_begin) == NOTE_INSN_BASIC_BLOCK))
-      break;
-  if (NOTE_LINE_NUMBER (fn_begin) == NOTE_INSN_FUNCTION_BEG)
+    if (NOTE_P (fn_begin))
+      {
+       if (NOTE_LINE_NUMBER (fn_begin) == NOTE_INSN_FUNCTION_BEG)
+         break;
+       else if (NOTE_LINE_NUMBER (fn_begin) == NOTE_INSN_BASIC_BLOCK)
+         fn_begin_outside_block = false;
+      }
+
+  if (fn_begin_outside_block)
     insert_insn_on_edge (seq, single_succ_edge (ENTRY_BLOCK_PTR));
   else
-    {
-      rtx last = BB_END (single_succ (ENTRY_BLOCK_PTR));
-      for (; ; fn_begin = NEXT_INSN (fn_begin))
-       if ((NOTE_P (fn_begin)
-            && NOTE_LINE_NUMBER (fn_begin) == NOTE_INSN_FUNCTION_BEG)
-           || fn_begin == last)
-         break;
-      emit_insn_after (seq, fn_begin);
-    }
+    emit_insn_after (seq, fn_begin);
 }
 
 /* Call back from expand_function_end to know where we should put