]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR target/84146 (ICE with -mcet in dwarf2out_var_location, involving sigsetjmp)
authorJakub Jelinek <jakub@redhat.com>
Mon, 19 Feb 2018 21:58:04 +0000 (22:58 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Mon, 19 Feb 2018 21:58:04 +0000 (22:58 +0100)
PR target/84146
* reg-notes.def (REG_CALL_ARG_LOCATION): New reg note.
* insn-notes.def (NOTE_INSN_CALL_ARG_LOCATION): Remove.
* var-tracking.c (emit_note_insn_var_location): Remove all references
to NOTE_INSN_CALL_ARG_LOCATION.
(emit_notes_in_bb): Emit arguments as REG_CALL_ARG_LOCATION note on
the CALL_INSN rather than separate NOTE_INSN_CALL_ARG_LOCATION note.
Use copy_rtx_if_shared.
* dwarf2out.c (gen_subprogram_die): Use XEXP with 0 instead of
NOTE_VAR_LOCATION on ca_loc->call_arg_loc_note.
(dwarf2out_var_location): Remove handling of
NOTE_INSN_CALL_ARG_LOCATION, instead handle REG_CALL_ARG_LOCATION note
on call_insn.
* final.c (final_scan_insn): Remove all references to
NOTE_INSN_CALL_ARG_LOCATION.
(rest_of_clean_state): Likewise.  Remove REG_CALL_ARG_LOCATION notes
before dumping final insns.
* except.c (emit_note_eh_region_end): Remove all references to
NOTE_INSN_CALL_ARG_LOCATION.
* config/alpha/alpha.c (alpha_pad_function_end): Likewise.
* config/c6x/c6x.c (c6x_gen_bundles): Likewise.
* config/arc/arc.c (hwloop_optimize): Likewise.
* config/arm/arm.c (create_fix_barrier): Likewise.
* config/s390/s390.c (s390_chunkify_start): Likewise.
* config/sh/sh.c (find_barrier): Likewise.
* config/i386/i386.c (rest_of_insert_endbranch,
ix86_seh_fixup_eh_fallthru): Likewise.
* config/xtensa/xtensa.c (hwloop_optimize): Likewise.
* config/iq2000/iq2000.c (final_prescan_insn): Likewise.
* config/frv/frv.c (frv_function_prologue): Likewise.
* emit-rtl.c (try_split): Likewise.  Copy over REG_CALL_ARG_LOCATION
reg note.
(note_outside_basic_block_p): Remove all references to
NOTE_INSN_CALL_ARG_LOCATION.
* gengtype.c (adjust_field_rtx_def): Likewise.
* print-rtl.c (rtx_writer::print_rtx_operand_code_0, print_insn):
Likewise.
* jump.c (cleanup_barriers, delete_related_insns): Likewise.
* cfgrtl.c (force_nonfallthru_and_redirect): Likewise.

* gcc.target/i386/pr84146.c: Add -fcompare-debug to dg-options.

From-SVN: r257826

24 files changed:
gcc/ChangeLog
gcc/cfgrtl.c
gcc/config/alpha/alpha.c
gcc/config/arc/arc.c
gcc/config/arm/arm.c
gcc/config/c6x/c6x.c
gcc/config/frv/frv.c
gcc/config/i386/i386.c
gcc/config/iq2000/iq2000.c
gcc/config/s390/s390.c
gcc/config/sh/sh.c
gcc/config/xtensa/xtensa.c
gcc/dwarf2out.c
gcc/emit-rtl.c
gcc/except.c
gcc/final.c
gcc/gengtype.c
gcc/insn-notes.def
gcc/jump.c
gcc/print-rtl.c
gcc/reg-notes.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr84146.c
gcc/var-tracking.c

index 6bef46372ac61ec7e8522513e0ceedc9400c72e6..900f9d5864cf1ed932605c289c28670fb5702238 100644 (file)
@@ -1,5 +1,45 @@
 2018-02-19  Jakub Jelinek  <jakub@redhat.com>
 
+       PR target/84146
+       * reg-notes.def (REG_CALL_ARG_LOCATION): New reg note.
+       * insn-notes.def (NOTE_INSN_CALL_ARG_LOCATION): Remove.
+       * var-tracking.c (emit_note_insn_var_location): Remove all references
+       to NOTE_INSN_CALL_ARG_LOCATION.
+       (emit_notes_in_bb): Emit arguments as REG_CALL_ARG_LOCATION note on
+       the CALL_INSN rather than separate NOTE_INSN_CALL_ARG_LOCATION note.
+       Use copy_rtx_if_shared.
+       * dwarf2out.c (gen_subprogram_die): Use XEXP with 0 instead of
+       NOTE_VAR_LOCATION on ca_loc->call_arg_loc_note.
+       (dwarf2out_var_location): Remove handling of
+       NOTE_INSN_CALL_ARG_LOCATION, instead handle REG_CALL_ARG_LOCATION note
+       on call_insn.
+       * final.c (final_scan_insn): Remove all references to
+       NOTE_INSN_CALL_ARG_LOCATION.
+       (rest_of_clean_state): Likewise.  Remove REG_CALL_ARG_LOCATION notes
+       before dumping final insns.
+       * except.c (emit_note_eh_region_end): Remove all references to
+       NOTE_INSN_CALL_ARG_LOCATION.
+       * config/alpha/alpha.c (alpha_pad_function_end): Likewise.
+       * config/c6x/c6x.c (c6x_gen_bundles): Likewise.
+       * config/arc/arc.c (hwloop_optimize): Likewise.
+       * config/arm/arm.c (create_fix_barrier): Likewise.
+       * config/s390/s390.c (s390_chunkify_start): Likewise.
+       * config/sh/sh.c (find_barrier): Likewise.
+       * config/i386/i386.c (rest_of_insert_endbranch,
+       ix86_seh_fixup_eh_fallthru): Likewise.
+       * config/xtensa/xtensa.c (hwloop_optimize): Likewise.
+       * config/iq2000/iq2000.c (final_prescan_insn): Likewise.
+       * config/frv/frv.c (frv_function_prologue): Likewise.
+       * emit-rtl.c (try_split): Likewise.  Copy over REG_CALL_ARG_LOCATION
+       reg note.
+       (note_outside_basic_block_p): Remove all references to
+       NOTE_INSN_CALL_ARG_LOCATION.
+       * gengtype.c (adjust_field_rtx_def): Likewise.
+       * print-rtl.c (rtx_writer::print_rtx_operand_code_0, print_insn):
+       Likewise.
+       * jump.c (cleanup_barriers, delete_related_insns): Likewise.
+       * cfgrtl.c (force_nonfallthru_and_redirect): Likewise.
+
        PR c++/84444
        * builtins.c (builtin_mathfn_code): Don't check if CALL_EXPR_FN (t)
        is ADDR_EXPR.
index 6ff80fd5c015052484254825b036386c3edd3c90..fd095ac59edb4579b1e7f376d00a18a6f2e8f427 100644 (file)
@@ -1628,11 +1628,6 @@ force_nonfallthru_and_redirect (edge e, basic_block target, rtx jump_label)
       else
        new_head = BB_END (e->src);
       new_head = NEXT_INSN (new_head);
-      /* Make sure we don't split a call and its corresponding
-        CALL_ARG_LOCATION note.  */
-      if (new_head && NOTE_P (new_head)
-         && NOTE_KIND (new_head) == NOTE_INSN_CALL_ARG_LOCATION)
-       new_head = NEXT_INSN (new_head);
 
       jump_block = create_basic_block (new_head, NULL, e->src);
       jump_block->count = count;
index 2f6d118606a33cb66b72edfcfa9a20e9f0f03f65..a039f045262c9dd794e06210287dda413afd31a4 100644 (file)
@@ -9406,14 +9406,6 @@ alpha_pad_function_end (void)
               || find_reg_note (insn, REG_NORETURN, NULL_RTX)))
         continue;
 
-      /* Make sure we do not split a call and its corresponding
-        CALL_ARG_LOCATION note.  */
-      next = NEXT_INSN (insn);
-      if (next == NULL)
-       continue;
-      if (NOTE_P (next) && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
-       insn = next;
-
       next = next_active_insn (insn);
       if (next)
        {
index 843defd4cda3344251bda4b6f2cb2a0cc1c81550..196d0e4a727974df38855fcef35553479e724df3 100644 (file)
@@ -7700,10 +7700,7 @@ hwloop_optimize (hwloop_info loop)
 #if 0
       while (DEBUG_INSN_P (entry_after)
              || (NOTE_P (entry_after)
-                 && NOTE_KIND (entry_after) != NOTE_INSN_BASIC_BLOCK
-                /* Make sure we don't split a call and its corresponding
-                   CALL_ARG_LOCATION note.  */
-                 && NOTE_KIND (entry_after) != NOTE_INSN_CALL_ARG_LOCATION))
+                && NOTE_KIND (entry_after) != NOTE_INSN_BASIC_BLOCK))
         entry_after = NEXT_INSN (entry_after);
 #endif
       entry_after = next_nonnote_nondebug_insn_bb (entry_after);
index 17feba46619c2ff729ec81520b516fb616ffcb11..90d62e699bce9594879be2e3016c9b36c7e064c8 100644 (file)
@@ -16556,16 +16556,6 @@ create_fix_barrier (Mfix *fix, HOST_WIDE_INT max_address)
   /* Make sure that we found a place to insert the jump.  */
   gcc_assert (selected);
 
-  /* Make sure we do not split a call and its corresponding
-     CALL_ARG_LOCATION note.  */
-  if (CALL_P (selected))
-    {
-      rtx_insn *next = NEXT_INSN (selected);
-      if (next && NOTE_P (next)
-         && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
-         selected = next;
-    }
-
   /* Create a new JUMP_INSN that branches around a barrier.  */
   from = emit_jump_insn_after (gen_jump (label), selected);
   JUMP_LABEL (from) = label;
index 762e29faa17a767b376c65dc961675461313b194..f12edfd082117b135c929583b82ded3b3a22b5b6 100644 (file)
@@ -4637,7 +4637,6 @@ static void
 c6x_gen_bundles (void)
 {
   basic_block bb;
-  rtx_insn *insn, *next, *last_call;
 
   FOR_EACH_BB_FN (bb, cfun)
     {
@@ -4704,29 +4703,6 @@ c6x_gen_bundles (void)
            break;
        }
     }
-  /* Bundling, and emitting nops, can separate
-     NOTE_INSN_CALL_ARG_LOCATION from the corresponding calls.  Fix
-     that up here.  */
-  last_call = NULL;
-  for (insn = get_insns (); insn; insn = next)
-    {
-      next = NEXT_INSN (insn);
-      if (CALL_P (insn)
-         || (INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE
-             && CALL_P (XVECEXP (PATTERN (insn), 0, 0))))
-       last_call = insn;
-      if (!NOTE_P (insn) || NOTE_KIND (insn) != NOTE_INSN_CALL_ARG_LOCATION)
-       continue;
-      if (NEXT_INSN (last_call) == insn)
-       continue;
-      SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
-      SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
-      SET_PREV_INSN (insn) = last_call;
-      SET_NEXT_INSN (insn) = NEXT_INSN (last_call);
-      SET_PREV_INSN (NEXT_INSN (insn)) = insn;
-      SET_NEXT_INSN (PREV_INSN (insn)) = insn;
-      last_call = insn;
-    }
 }
 
 /* Emit a NOP instruction for CYCLES cycles after insn AFTER.  Return it.  */
index 3bf770b36497f7e774fce4583eeb5282f02b6ce5..56027bd67d9dd53868e325c0319974652fad9602 100644 (file)
@@ -1415,8 +1415,6 @@ frv_function_contains_far_jump (void)
 static void
 frv_function_prologue (FILE *file)
 {
-  rtx_insn *insn, *next, *last_call;
-
   /* If no frame was created, check whether the function uses a call
      instruction to implement a far jump.  If so, save the link in gr3 and
      replace all returns to LR with returns to GR3.  GR3 is used because it
@@ -1457,32 +1455,6 @@ frv_function_prologue (FILE *file)
 
   /* Allow the garbage collector to free the nops created by frv_reorg.  */
   memset (frv_nops, 0, sizeof (frv_nops));
-
-  /* Locate CALL_ARG_LOCATION notes that have been misplaced
-     and move them back to where they should be located.  */
-  last_call = NULL;
-  for (insn = get_insns (); insn; insn = next)
-    {
-      next = NEXT_INSN (insn);
-      if (CALL_P (insn)
-         || (INSN_P (insn) && GET_CODE (PATTERN (insn)) == SEQUENCE
-             && CALL_P (XVECEXP (PATTERN (insn), 0, 0))))
-       last_call = insn;
-
-      if (!NOTE_P (insn) || NOTE_KIND (insn) != NOTE_INSN_CALL_ARG_LOCATION)
-       continue;
-
-      if (NEXT_INSN (last_call) == insn)
-       continue;
-
-      SET_NEXT_INSN (PREV_INSN (insn)) = NEXT_INSN (insn);
-      SET_PREV_INSN (NEXT_INSN (insn)) = PREV_INSN (insn);
-      SET_PREV_INSN (insn) = last_call;
-      SET_NEXT_INSN (insn) = NEXT_INSN (last_call);
-      SET_PREV_INSN (NEXT_INSN (insn)) = insn;
-      SET_NEXT_INSN (PREV_INSN (insn)) = insn;
-      last_call = insn;
-    }
 }
 
 \f
index 4a968a75a9e25d122f7db7ce717bf35be5b5c2c3..d54e7301e84be79d84091e0a476fa20e895f0746 100644 (file)
@@ -2619,16 +2619,8 @@ rest_of_insert_endbranch (void)
              /* Generate ENDBRANCH after CALL, which can return more than
                 twice, setjmp-like functions.  */
 
-             /* Skip notes that must immediately follow the call insn.  */
-             rtx_insn *next_insn = insn;
-             if (NEXT_INSN (insn)
-                 && NOTE_P (NEXT_INSN (insn))
-                 && (NOTE_KIND (NEXT_INSN (insn))
-                     == NOTE_INSN_CALL_ARG_LOCATION))
-               next_insn = NEXT_INSN (insn);
-
              cet_eb = gen_nop_endbr ();
-             emit_insn_after_setloc (cet_eb, next_insn, INSN_LOCATION (insn));
+             emit_insn_after_setloc (cet_eb, insn, INSN_LOCATION (insn));
              continue;
            }
 
@@ -42128,9 +42120,7 @@ ix86_seh_fixup_eh_fallthru (void)
 
       /* Do not separate calls from their debug information.  */
       for (next = NEXT_INSN (insn); next != NULL; next = NEXT_INSN (next))
-       if (NOTE_P (next)
-            && (NOTE_KIND (next) == NOTE_INSN_VAR_LOCATION
-                || NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION))
+       if (NOTE_P (next) && NOTE_KIND (next) == NOTE_INSN_VAR_LOCATION)
          insn = next;
        else
          break;
index 18588084c107c2372cfa874c32240efe93ca724b..ee89ced0e2f0f2d23c635a81a508ea4ac061b7ae 100644 (file)
@@ -1578,13 +1578,7 @@ final_prescan_insn (rtx_insn *insn, rtx opvec[] ATTRIBUTE_UNUSED,
        || (GET_CODE (PATTERN (insn)) == RETURN))
           && NEXT_INSN (PREV_INSN (insn)) == insn)
     {
-      rtx_insn *tmp = insn;
-      while (NEXT_INSN (tmp)
-            && NOTE_P (NEXT_INSN (tmp))
-            && NOTE_KIND (NEXT_INSN (tmp)) == NOTE_INSN_CALL_ARG_LOCATION)
-       tmp = NEXT_INSN (tmp);
-
-      rtx_insn *nop_insn = emit_insn_after (gen_nop (), tmp);
+      rtx_insn *nop_insn = emit_insn_after (gen_nop (), insn);
       INSN_ADDRESSES_NEW (nop_insn, -1);
     }
   
index 298fdd164904102406ffb52c0ca3757627eada8f..51adb0df480d75e206de155f9c8a1c0d854cdb2e 100644 (file)
@@ -9259,7 +9259,6 @@ s390_chunkify_start (void)
            section_switch_p = true;
            break;
          case NOTE_INSN_VAR_LOCATION:
-         case NOTE_INSN_CALL_ARG_LOCATION:
            continue;
          default:
            break;
@@ -9330,8 +9329,7 @@ s390_chunkify_start (void)
                    }
                  while (next
                         && NOTE_P (next)
-                        && (NOTE_KIND (next) == NOTE_INSN_VAR_LOCATION
-                            || NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION));
+                        && NOTE_KIND (next) == NOTE_INSN_VAR_LOCATION);
                }
              else
                {
index 90d6c733d335279d390ddefc2fa34d0db8e493ae..ced66408265c39de095d0cd8f3b15f5c2ca6f6cc 100644 (file)
@@ -5225,21 +5225,13 @@ find_barrier (int num_mova, rtx_insn *mova, rtx_insn *from)
         around the constant pool table will be hit.  Putting it before
         a jump makes it more likely that the bra delay slot will be
         filled.  */
-      while (NOTE_P (from) || JUMP_P (from)
-            || LABEL_P (from))
+      while (NOTE_P (from) || JUMP_P (from) || LABEL_P (from))
        from = PREV_INSN (from);
 
-      /* Make sure we do not split between a call and its corresponding
-        CALL_ARG_LOCATION note.  */
       if (CALL_P (from))
        {
          bool sibcall_p = SIBLING_CALL_P (from);
 
-         rtx_insn *next = NEXT_INSN (from);
-         if (next && NOTE_P (next)
-             && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
-           from = next;
-
          /* If FROM was a sibling call, then we know that control
             will not return.  In fact, we were guaranteed to hit
             a barrier before another real insn.
index 23cdf4d26bf5bbf2199c35d7cbfa98849d1c68a3..7cfe64d4289594364c8318855bd61759632c3f78 100644 (file)
@@ -4255,10 +4255,7 @@ hwloop_optimize (hwloop_info loop)
       entry_after = BB_END (entry_bb);
       while (DEBUG_INSN_P (entry_after)
              || (NOTE_P (entry_after)
-                 && NOTE_KIND (entry_after) != NOTE_INSN_BASIC_BLOCK
-                /* Make sure we don't split a call and its corresponding
-                   CALL_ARG_LOCATION note.  */
-                 && NOTE_KIND (entry_after) != NOTE_INSN_CALL_ARG_LOCATION))
+                && NOTE_KIND (entry_after) != NOTE_INSN_BASIC_BLOCK))
         entry_after = PREV_INSN (entry_after);
 
       emit_insn_after (seq, entry_after);
index 4e2bf3b4c88b21e263c516aef0e4da2ceaa05045..5e88c7bacf063b896479649917f09ec45fb032f3 100644 (file)
@@ -23110,7 +23110,7 @@ gen_subprogram_die (tree decl, dw_die_ref context_die)
              rtx arg, next_arg;
 
              for (arg = (ca_loc->call_arg_loc_note != NULL_RTX
-                         ? NOTE_VAR_LOCATION (ca_loc->call_arg_loc_note)
+                         ? XEXP (ca_loc->call_arg_loc_note, 0)
                          : NULL_RTX);
                   arg; arg = next_arg)
                {
@@ -26975,6 +26975,17 @@ dwarf2out_var_location (rtx_insn *loc_note)
          call_site_count++;
          if (SIBLING_CALL_P (loc_note))
            tail_call_site_count++;
+         if (find_reg_note (loc_note, REG_CALL_ARG_LOCATION, NULL_RTX))
+           {
+             call_insn = loc_note;
+             loc_note = NULL;
+             var_loc_p = false;
+
+             next_real = dwarf2out_next_real_insn (call_insn);
+             next_note = NULL;
+             cached_next_real_insn = NULL;
+             goto create_label;
+           }
          if (optimize == 0 && !flag_var_tracking)
            {
              /* When the var-tracking pass is not running, there is no note
@@ -27034,8 +27045,7 @@ dwarf2out_var_location (rtx_insn *loc_note)
       || ! NOTE_P (next_note)
       || (NOTE_KIND (next_note) != NOTE_INSN_VAR_LOCATION
          && NOTE_KIND (next_note) != NOTE_INSN_BEGIN_STMT
-         && NOTE_KIND (next_note) != NOTE_INSN_INLINE_ENTRY
-         && NOTE_KIND (next_note) != NOTE_INSN_CALL_ARG_LOCATION))
+         && NOTE_KIND (next_note) != NOTE_INSN_INLINE_ENTRY))
     next_note = NULL;
 
   if (! next_real)
@@ -27145,10 +27155,10 @@ create_label:
     {
       struct call_arg_loc_node *ca_loc
        = ggc_cleared_alloc<call_arg_loc_node> ();
-      rtx_insn *prev
-        = loc_note != NULL_RTX ? prev_real_insn (loc_note) : call_insn;
+      rtx_insn *prev = call_insn;
 
-      ca_loc->call_arg_loc_note = loc_note;
+      ca_loc->call_arg_loc_note
+       = find_reg_note (call_insn, REG_CALL_ARG_LOCATION, NULL_RTX);
       ca_loc->next = NULL;
       ca_loc->label = last_label;
       gcc_assert (prev
index a722985b5d951e6bef4023140a4f1e9117c06505..dd8fec3f34938a81398fd12be4671230611191f3 100644 (file)
@@ -3866,15 +3866,12 @@ try_split (rtx pat, rtx_insn *trial, int last)
       for (insn = insn_last; insn ; insn = PREV_INSN (insn))
        if (CALL_P (insn))
          {
-           rtx_insn *next;
-           rtx *p;
-
            gcc_assert (call_insn == NULL_RTX);
            call_insn = insn;
 
            /* Add the old CALL_INSN_FUNCTION_USAGE to whatever the
               target may have explicitly specified.  */
-           p = &CALL_INSN_FUNCTION_USAGE (insn);
+           rtx *p = &CALL_INSN_FUNCTION_USAGE (insn);
            while (*p)
              p = &XEXP (*p, 1);
            *p = CALL_INSN_FUNCTION_USAGE (trial);
@@ -3882,21 +3879,6 @@ try_split (rtx pat, rtx_insn *trial, int last)
            /* If the old call was a sibling call, the new one must
               be too.  */
            SIBLING_CALL_P (insn) = SIBLING_CALL_P (trial);
-
-           /* If the new call is the last instruction in the sequence,
-              it will effectively replace the old call in-situ.  Otherwise
-              we must move any following NOTE_INSN_CALL_ARG_LOCATION note
-              so that it comes immediately after the new call.  */
-           if (NEXT_INSN (insn))
-             for (next = NEXT_INSN (trial);
-                  next && NOTE_P (next);
-                  next = NEXT_INSN (next))
-               if (NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
-                 {
-                   remove_insn (next);
-                   add_insn_after (next, insn, NULL);
-                   break;
-                 }
          }
     }
 
@@ -3913,6 +3895,7 @@ try_split (rtx pat, rtx_insn *trial, int last)
        case REG_SETJMP:
        case REG_TM:
        case REG_CALL_NOCF_CHECK:
+       case REG_CALL_ARG_LOCATION:
          for (insn = insn_last; insn != NULL_RTX; insn = PREV_INSN (insn))
            {
              if (CALL_P (insn))
@@ -4777,7 +4760,6 @@ note_outside_basic_block_p (enum insn_note subtype, bool on_bb_boundary_p)
         inside basic blocks.  If the caller is emitting on the basic block
         boundary, do not set BLOCK_FOR_INSN on the new note.  */
       case NOTE_INSN_VAR_LOCATION:
-      case NOTE_INSN_CALL_ARG_LOCATION:
       case NOTE_INSN_EH_REGION_BEG:
       case NOTE_INSN_EH_REGION_END:
        return on_bb_boundary_p;
index bd587de183624a4c5605c239b0fa7058ad31119c..04d4764ee17ece4b30985d0d9d091da5308f3f4f 100644 (file)
@@ -2465,14 +2465,6 @@ add_call_site (rtx landing_pad, int action, int section)
 static rtx_note *
 emit_note_eh_region_end (rtx_insn *insn)
 {
-  rtx_insn *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);
 }
 
index cbebbfdf5b077e4a01b0acd29b4e4ddf9d23ad4f..78a750388e62c842bb50220db41a02c250505fd0 100644 (file)
@@ -2467,7 +2467,6 @@ final_scan_insn_1 (rtx_insn *insn, FILE *file, int optimize_p ATTRIBUTE_UNUSED,
          break;
 
        case NOTE_INSN_VAR_LOCATION:
-       case NOTE_INSN_CALL_ARG_LOCATION:
          if (!DECL_IGNORED_P (current_function_decl))
            {
              debug_hooks->var_location (insn);
@@ -4846,15 +4845,21 @@ rest_of_clean_state (void)
       SET_NEXT_INSN (insn) = NULL;
       SET_PREV_INSN (insn) = NULL;
 
+      if (CALL_P (insn))
+       {
+         rtx note = find_reg_note (insn, REG_CALL_ARG_LOCATION, NULL_RTX);
+         if (note)
+           remove_note (insn, note);
+       }
+
       if (final_output
-         && (!NOTE_P (insn) ||
-             (NOTE_KIND (insn) != NOTE_INSN_VAR_LOCATION
-              && NOTE_KIND (insn) != NOTE_INSN_BEGIN_STMT
-              && NOTE_KIND (insn) != NOTE_INSN_INLINE_ENTRY
-              && NOTE_KIND (insn) != NOTE_INSN_CALL_ARG_LOCATION
-              && NOTE_KIND (insn) != NOTE_INSN_BLOCK_BEG
-              && NOTE_KIND (insn) != NOTE_INSN_BLOCK_END
-              && NOTE_KIND (insn) != NOTE_INSN_DELETED_DEBUG_LABEL)))
+         && (!NOTE_P (insn)
+             || (NOTE_KIND (insn) != NOTE_INSN_VAR_LOCATION
+                 && NOTE_KIND (insn) != NOTE_INSN_BEGIN_STMT
+                 && NOTE_KIND (insn) != NOTE_INSN_INLINE_ENTRY
+                 && NOTE_KIND (insn) != NOTE_INSN_BLOCK_BEG
+                 && NOTE_KIND (insn) != NOTE_INSN_BLOCK_END
+                 && NOTE_KIND (insn) != NOTE_INSN_DELETED_DEBUG_LABEL)))
        print_rtl_single (final_output, insn);
     }
 
index c94008ee0c4acf632c20b585294808e9109ab6a0..0db5528e632300b2deaf86a2a4859b6d28e018d9 100644 (file)
@@ -1187,7 +1187,6 @@ adjust_field_rtx_def (type_p t, options_p ARG_UNUSED (opt))
            break;
 
          case NOTE_INSN_VAR_LOCATION:
-         case NOTE_INSN_CALL_ARG_LOCATION:
            note_flds = create_field (note_flds, rtx_tp, "rt_rtx");
            break;
 
index 9cac5f1549a75ca87f342ccaf3ebbd073334ac3e..0afd47504ec9c8c856ccafede9064327d82818ca 100644 (file)
@@ -65,9 +65,6 @@ INSN_NOTE (EH_REGION_END)
 /* The location of a variable.  */
 INSN_NOTE (VAR_LOCATION)
 
-/* The values passed to callee.  */
-INSN_NOTE (CALL_ARG_LOCATION)
-
 /* The beginning of a statement.  */
 INSN_NOTE (BEGIN_STMT)
 
index dcc85949aa27641026b6a0faee20a61b907b58e7..f379048f636856dc43c03128912e36eea23bebd1 100644 (file)
@@ -127,17 +127,6 @@ cleanup_barriers (void)
          if (!prev)
            continue;
 
-         if (CALL_P (prev))
-           {
-             /* Make sure we do not split a call and its corresponding
-                CALL_ARG_LOCATION note.  */
-             rtx_insn *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))
@@ -1279,26 +1268,6 @@ delete_related_insns (rtx uncast_insn)
   if (next != 0 && BARRIER_P (next))
     delete_insn (next);
 
-  /* If this is a call, then we have to remove the var tracking note
-     for the call arguments.  */
-
-  if (CALL_P (insn)
-      || (NONJUMP_INSN_P (insn)
-         && GET_CODE (PATTERN (insn)) == SEQUENCE
-         && CALL_P (XVECEXP (PATTERN (insn), 0, 0))))
-    {
-      rtx_insn *p;
-
-      for (p = next && next->deleted () ? NEXT_INSN (next) : next;
-          p && NOTE_P (p);
-          p = NEXT_INSN (p))
-       if (NOTE_KIND (p) == NOTE_INSN_CALL_ARG_LOCATION)
-         {
-           remove_insn (p);
-           break;
-         }
-    }
-
   /* If deleting a jump, decrement the count of the label,
      and delete the label if it is now unused.  */
 
index 3ad11dc4cf9b3524d660a75694383c368e98628d..37c0d53fae276152c94139cf2d1ad01edab58b97 100644 (file)
@@ -264,7 +264,6 @@ rtx_writer::print_rtx_operand_code_0 (const_rtx in_rtx ATTRIBUTE_UNUSED,
          }
 
        case NOTE_INSN_VAR_LOCATION:
-       case NOTE_INSN_CALL_ARG_LOCATION:
          fputc (' ', m_outfile);
          print_rtx (NOTE_VAR_LOCATION (in_rtx));
          break;
@@ -1970,7 +1969,6 @@ print_insn (pretty_printer *pp, const rtx_insn *x, int verbose)
            break;
 
          case NOTE_INSN_VAR_LOCATION:
-         case NOTE_INSN_CALL_ARG_LOCATION:
            pp_left_brace (pp);
            print_pattern (pp, NOTE_VAR_LOCATION (x), verbose);
            pp_right_brace (pp);
index f9caa247f2c4beba29f5d408313e8525766cfe1d..76f3f4521868639a76eb0774bc6d6f763a60e46c 100644 (file)
@@ -239,3 +239,6 @@ REG_NOTE (CALL_DECL)
    when a called function has a 'notrack' attribute.  This note is used by the
    compiler when the option -fcf-protection=branch is specified.  */
 REG_NOTE (CALL_NOCF_CHECK)
+
+/* The values passed to callee, for debuginfo purposes.  */
+REG_NOTE (CALL_ARG_LOCATION)
index 15638f7b0ad64ec89f1a35cf044061996141116b..286a6af5a4b19387558d5ad932871ff3b87079f3 100644 (file)
@@ -1,3 +1,8 @@
+2018-02-19  Jakub Jelinek  <jakub@redhat.com>
+
+       PR target/84146
+       * gcc.target/i386/pr84146.c: Add -fcompare-debug to dg-options.
+
 2017-02-19  Uros Bizjak  <ubizjak@gmail.com>
 
        * gcc.target/i386/pr70023.c (dg-do): Compile only for target int128.
index ba9b6336c0dbb70c5fad3c34d79f097538772751..a14baa47532fa627f3efc7a29a35c002927ecf26 100644 (file)
@@ -1,6 +1,6 @@
 /* PR target/84146 */
 /* { dg-do compile } */
-/* { dg-options "-O2 -g -mcet -fcf-protection=full" } */
+/* { dg-options "-O2 -g -mcet -fcf-protection=full -fcompare-debug" } */
 
 int __setjmp (void **);
 void *buf[64];
index fb30ec223efbe54af56028a8a9a3d58a3eabfecb..56a701c283e87d3636e2130447fd6320a3ffd0e5 100644 (file)
@@ -8860,14 +8860,12 @@ emit_note_insn_var_location (variable **varp, emit_note_data *data)
       /* Make sure that the call related notes come first.  */
       while (NEXT_INSN (insn)
             && NOTE_P (insn)
-            && ((NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION
-                 && NOTE_DURING_CALL_P (insn))
-                || NOTE_KIND (insn) == NOTE_INSN_CALL_ARG_LOCATION))
+            && NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION
+            && NOTE_DURING_CALL_P (insn))
        insn = NEXT_INSN (insn);
       if (NOTE_P (insn)
-         && ((NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION
-              && NOTE_DURING_CALL_P (insn))
-             || NOTE_KIND (insn) == NOTE_INSN_CALL_ARG_LOCATION))
+         && NOTE_KIND (insn) == NOTE_INSN_VAR_LOCATION
+         && NOTE_DURING_CALL_P (insn))
        note = emit_note_after (NOTE_INSN_VAR_LOCATION, insn);
       else
        note = emit_note_before (NOTE_INSN_VAR_LOCATION, insn);
@@ -9210,7 +9208,6 @@ emit_notes_in_bb (basic_block bb, dataflow_set *set)
            emit_notes_for_changes (insn, EMIT_NOTE_AFTER_CALL_INSN, set->vars);
            {
              rtx arguments = mo->u.loc, *p = &arguments;
-             rtx_note *note;
              while (*p)
                {
                  XEXP (XEXP (*p, 0), 1)
@@ -9218,7 +9215,11 @@ emit_notes_in_bb (basic_block bb, dataflow_set *set)
                                     shared_hash_htab (set->vars));
                  /* If expansion is successful, keep it in the list.  */
                  if (XEXP (XEXP (*p, 0), 1))
-                   p = &XEXP (*p, 1);
+                   {
+                     XEXP (XEXP (*p, 0), 1)
+                       = copy_rtx_if_shared (XEXP (XEXP (*p, 0), 1));
+                     p = &XEXP (*p, 1);
+                   }
                  /* Otherwise, if the following item is data_value for it,
                     drop it too too.  */
                  else if (XEXP (*p, 1)
@@ -9234,8 +9235,7 @@ emit_notes_in_bb (basic_block bb, dataflow_set *set)
                  else
                    *p = XEXP (*p, 1);
                }
-             note = emit_note_after (NOTE_INSN_CALL_ARG_LOCATION, insn);
-             NOTE_VAR_LOCATION (note) = arguments;
+             add_reg_note (insn, REG_CALL_ARG_LOCATION, arguments);
            }
            break;