except.c (emit_note_eh_region_end): New helper function.
authorUros Bizjak <ubizjak@gmail.com>
Mon, 30 Jun 2014 19:30:52 +0000 (21:30 +0200)
committerUros Bizjak <uros@gcc.gnu.org>
Mon, 30 Jun 2014 19:30:52 +0000 (21:30 +0200)
* except.c (emit_note_eh_region_end): New helper function.
(convert_to_eh_region_ranges): Use emit_note_eh_region_end to
emit EH_REGION_END note.
* jump.c (cleanup_barriers): Do not split a call and its
corresponding CALL_ARG_LOCATION note.

From-SVN: r212171

gcc/ChangeLog
gcc/except.c
gcc/jump.c

index 7692bfb88c7b1706b13eb92faaf692982d251057..a571eef7fa04f837e7296ec7889d6f927bee6680 100644 (file)
@@ -1,3 +1,11 @@
+2014-06-30  Uros Bizjak  <ubizjak@gmail.com>
+
+       * except.c (emit_note_eh_region_end): New helper function.
+       (convert_to_eh_region_ranges): Use emit_note_eh_region_end to
+       emit EH_REGION_END note.
+       * jump.c (cleanup_barriers): Do not split a call and its
+       corresponding CALL_ARG_LOCATION note.
+
 2014-06-30  Jeff Law  <law@redhat.com>
 
        PR tree-optimization/61607
index dc5c1d20132b08ddb9b240a19f68e3518d19eb84..7ac114fda27e8dabe8d528f5864ece51eba649fa 100644 (file)
@@ -2466,6 +2466,20 @@ add_call_site (rtx landing_pad, int action, int section)
   return call_site_base + crtl->eh.call_site_record_v[section]->length () - 1;
 }
 
+static rtx
+emit_note_eh_region_end (rtx insn)
+{
+  rtx next = NEXT_INSN (insn);
+
+  /* Make sure we do not split a call and its corresponding
+     CALL_ARG_LOCATION note.  */
+  if (next && NOTE_P (next)
+      && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
+    insn = next;
+
+  return emit_note_after (NOTE_INSN_EH_REGION_END, insn);
+}
+
 /* Turn REG_EH_REGION notes back into NOTE_INSN_EH_REGION notes.
    The new note numbers will not refer to region numbers, but
    instead to call site entries.  */
@@ -2544,8 +2558,8 @@ convert_to_eh_region_ranges (void)
                note = emit_note_before (NOTE_INSN_EH_REGION_BEG,
                                         first_no_action_insn_before_switch);
                NOTE_EH_HANDLER (note) = call_site;
-               note = emit_note_after (NOTE_INSN_EH_REGION_END,
-                                       last_no_action_insn_before_switch);
+               note
+                 = emit_note_eh_region_end (last_no_action_insn_before_switch);
                NOTE_EH_HANDLER (note) = call_site;
                gcc_assert (last_action != -3
                            || (last_action_insn
@@ -2569,8 +2583,7 @@ convert_to_eh_region_ranges (void)
                    first_no_action_insn = NULL_RTX;
                  }
 
-               note = emit_note_after (NOTE_INSN_EH_REGION_END,
-                                       last_action_insn);
+               note = emit_note_eh_region_end (last_action_insn);
                NOTE_EH_HANDLER (note) = call_site;
              }
 
@@ -2617,7 +2630,7 @@ convert_to_eh_region_ranges (void)
 
   if (last_action >= -1 && ! first_no_action_insn)
     {
-      note = emit_note_after (NOTE_INSN_EH_REGION_END, last_action_insn);
+      note = emit_note_eh_region_end (last_action_insn);
       NOTE_EH_HANDLER (note) = call_site;
     }
 
index 9418f6529fa23aa8f5e67fc210b703c5095ccb0a..a5e5f528e75763393677533bb7b0ae10620428a0 100644 (file)
@@ -121,15 +121,26 @@ rebuild_jump_labels_chain (rtx chain)
 static unsigned int
 cleanup_barriers (void)
 {
-  rtx insn, next, prev;
-  for (insn = get_insns (); insn; insn = next)
+  rtx insn;
+  for (insn = get_insns (); insn; insn = NEXT_INSN (insn))
     {
-      next = NEXT_INSN (insn);
       if (BARRIER_P (insn))
        {
-         prev = prev_nonnote_insn (insn);
+         rtx prev = prev_nonnote_insn (insn);
          if (!prev)
            continue;
+
+         if (CALL_P (prev))
+           {
+             /* Make sure we do not split a call and its corresponding
+                CALL_ARG_LOCATION note.  */
+             rtx next = NEXT_INSN (prev);
+
+             if (NOTE_P (next)
+                 && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
+               prev = next;
+           }
+
          if (BARRIER_P (prev))
            delete_insn (insn);
          else if (prev != PREV_INSN (insn))