This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix -fcompare-debug failure on pr84146.c (PR target/84146)


Hi Jakub:

It's introduce a regression on mips target.
see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84623.

Paul hua


On Thu, Feb 8, 2018 at 6:36 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> Hi!
>
> Unfortunately, seems my rest_of_insert_endbranch fix doesn't fix
> -fcompare-debug on the testcase, when adding the endbr after the setjmp
> call with no note in between, we add it into the same bb as the setjmp call,
> while when adding it with -g with NOTE_INSN_CALL_ARG_LOCATION, which is
> already outside of the bb, we add it outside of bb.
>
> This patch fixes it by removing lots of code:
>  22 files changed, 50 insertions(+), 205 deletions(-)
> instead of sticking the call arg location info into a separate note that
> is required to be adjacent to the call and thus requires lots of special
> cases everywhere we emit it as a REG_CALL_ARG_LOCATION note in REG_NOTES
> directly on the call.
> All we need to ensure is that we remove that reg note before emitting
> -fcompare-debug final insns dump, and need to unshare the rtl in there
> (apparently rtl sharing verification ignores
> NOTE_INSN_{CALL_ARG,VAR}_LOCATION notes, but of course not REG_NOTES).
>
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
>
> 2018-02-07  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.
>
>         * gcc.target/i386/pr84146.c: Add -fcompare-debug to dg-options.
>
> --- gcc/reg-notes.def.jj        2018-01-03 10:19:55.239533971 +0100
> +++ gcc/reg-notes.def   2018-02-07 16:40:03.800915206 +0100
> @@ -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)
> --- gcc/insn-notes.def.jj       2018-01-03 10:19:55.669534040 +0100
> +++ gcc/insn-notes.def  2018-02-07 16:40:03.800915206 +0100
> @@ -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)
>
> --- gcc/var-tracking.c.jj       2018-02-07 13:11:26.950985542 +0100
> +++ gcc/var-tracking.c  2018-02-07 16:44:10.810478942 +0100
> @@ -8860,14 +8860,12 @@ emit_note_insn_var_location (variable **
>        /* 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, datafl
>             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, datafl
>                                      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, datafl
>                   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;
>
> --- gcc/dwarf2out.c.jj  2018-02-06 21:30:56.402732183 +0100
> +++ gcc/dwarf2out.c     2018-02-07 16:43:08.201589517 +0100
> @@ -22607,7 +22607,7 @@ gen_subprogram_die (tree decl, dw_die_re
>               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)
>                 {
> @@ -26366,6 +26366,17 @@ dwarf2out_var_location (rtx_insn *loc_no
>           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
> @@ -26419,8 +26430,7 @@ dwarf2out_var_location (rtx_insn *loc_no
>        || next_note->deleted ()
>        || ! 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_CALL_ARG_LOCATION))
> +         && NOTE_KIND (next_note) != NOTE_INSN_BEGIN_STMT))
>      next_note = NULL;
>
>    if (! next_real)
> @@ -26529,10 +26539,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
> --- gcc/final.c.jj      2018-01-18 21:11:57.272207030 +0100
> +++ gcc/final.c 2018-02-07 17:15:40.031809548 +0100
> @@ -2355,7 +2355,6 @@ final_scan_insn (rtx_insn *insn, FILE *f
>           break;
>
>         case NOTE_INSN_VAR_LOCATION:
> -       case NOTE_INSN_CALL_ARG_LOCATION:
>           if (!DECL_IGNORED_P (current_function_decl))
>             debug_hooks->var_location (insn);
>           break;
> @@ -4664,14 +4663,19 @@ 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_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_BLOCK_BEG
> +                 && NOTE_KIND (insn) != NOTE_INSN_BLOCK_END
> +                 && NOTE_KIND (insn) != NOTE_INSN_DELETED_DEBUG_LABEL)))
>         print_rtl_single (final_output, insn);
>      }
>
> --- gcc/except.c.jj     2018-01-03 10:19:55.864534071 +0100
> +++ gcc/except.c        2018-02-07 16:43:08.200589519 +0100
> @@ -2465,14 +2465,6 @@ add_call_site (rtx landing_pad, int acti
>  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);
>  }
>
> --- gcc/config/alpha/alpha.c.jj 2018-01-04 12:37:25.259487337 +0100
> +++ gcc/config/alpha/alpha.c    2018-02-07 16:43:08.200589519 +0100
> @@ -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)
>         {
> --- gcc/config/c6x/c6x.c.jj     2018-01-03 10:20:00.740534851 +0100
> +++ gcc/config/c6x/c6x.c        2018-02-07 16:43:08.201589517 +0100
> @@ -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.  */
> --- gcc/config/arc/arc.c.jj     2018-01-31 21:38:10.510050496 +0100
> +++ gcc/config/arc/arc.c        2018-02-07 16:43:08.201589517 +0100
> @@ -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);
> --- gcc/config/arm/arm.c.jj     2018-02-06 13:13:08.930742979 +0100
> +++ gcc/config/arm/arm.c        2018-02-07 16:43:08.201589517 +0100
> @@ -16556,16 +16556,6 @@ create_fix_barrier (Mfix *fix, HOST_WIDE
>    /* 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;
> --- gcc/config/s390/s390.c.jj   2018-01-03 10:20:05.176535560 +0100
> +++ gcc/config/s390/s390.c      2018-02-07 16:43:08.201589517 +0100
> @@ -9224,7 +9224,6 @@ s390_chunkify_start (void)
>             section_switch_p = true;
>             break;
>           case NOTE_INSN_VAR_LOCATION:
> -         case NOTE_INSN_CALL_ARG_LOCATION:
>             continue;
>           default:
>             break;
> @@ -9295,8 +9294,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
>                 {
> --- gcc/config/sh/sh.c.jj       2018-01-14 17:16:55.869836128 +0100
> +++ gcc/config/sh/sh.c  2018-02-07 16:43:08.201589517 +0100
> @@ -5229,16 +5229,6 @@ find_barrier (int num_mova, rtx_insn *mo
>              || 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))
> -       {
> -         rtx_insn *next = NEXT_INSN (from);
> -         if (next && NOTE_P (next)
> -             && NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION)
> -           from = next;
> -       }
> -
>        from = emit_jump_insn_after (gen_jump (label), from);
>        JUMP_LABEL (from) = label;
>        LABEL_NUSES (label) = 1;
> --- gcc/config/i386/i386.c.jj   2018-02-07 13:11:29.449980343 +0100
> +++ gcc/config/i386/i386.c      2018-02-07 16:43:08.201589517 +0100
> @@ -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;
>             }
>
> @@ -42115,9 +42107,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;
> --- gcc/config/xtensa/xtensa.c.jj       2018-01-03 10:20:07.506535933 +0100
> +++ gcc/config/xtensa/xtensa.c  2018-02-07 16:43:08.201589517 +0100
> @@ -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);
> --- gcc/config/iq2000/iq2000.c.jj       2018-01-03 10:20:08.778536124 +0100
> +++ gcc/config/iq2000/iq2000.c  2018-02-07 16:43:08.201589517 +0100
> @@ -1578,13 +1578,7 @@ final_prescan_insn (rtx_insn *insn, rtx
>         || (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);
>      }
>
> --- gcc/config/frv/frv.c.jj     2018-01-03 10:20:15.021537135 +0100
> +++ gcc/config/frv/frv.c        2018-02-07 16:43:08.201589517 +0100
> @@ -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;
> -    }
>  }
>
>
> --- gcc/emit-rtl.c.jj   2018-01-10 10:00:09.241349608 +0100
> +++ gcc/emit-rtl.c      2018-02-07 16:43:08.201589517 +0100
> @@ -3866,15 +3866,12 @@ try_split (rtx pat, rtx_insn *trial, int
>        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
>             /* 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
>         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_no
>          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;
> --- gcc/gengtype.c.jj   2018-01-03 10:19:54.626533873 +0100
> +++ gcc/gengtype.c      2018-02-07 16:43:08.201589517 +0100
> @@ -1187,7 +1187,6 @@ adjust_field_rtx_def (type_p t, options_
>             break;
>
>           case NOTE_INSN_VAR_LOCATION:
> -         case NOTE_INSN_CALL_ARG_LOCATION:
>             note_flds = create_field (note_flds, rtx_tp, "rt_rtx");
>             break;
>
> --- gcc/print-rtl.c.jj  2018-01-03 10:19:55.991534091 +0100
> +++ gcc/print-rtl.c     2018-02-07 16:43:08.201589517 +0100
> @@ -264,7 +264,6 @@ rtx_writer::print_rtx_operand_code_0 (co
>           }
>
>         case NOTE_INSN_VAR_LOCATION:
> -       case NOTE_INSN_CALL_ARG_LOCATION:
>           fputc (' ', m_outfile);
>           print_rtx (NOTE_VAR_LOCATION (in_rtx));
>           break;
> @@ -1965,7 +1964,6 @@ print_insn (pretty_printer *pp, const rt
>             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);
> --- gcc/jump.c.jj       2018-01-03 10:19:54.949533924 +0100
> +++ gcc/jump.c  2018-02-07 16:43:08.201589517 +0100
> @@ -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.  */
>
> --- gcc/cfgrtl.c.jj     2018-01-11 19:01:11.904444589 +0100
> +++ gcc/cfgrtl.c        2018-02-07 16:43:08.201589517 +0100
> @@ -1628,11 +1628,6 @@ force_nonfallthru_and_redirect (edge e,
>        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;
> --- gcc/testsuite/gcc.target/i386/pr84146.c.jj  2018-02-06 21:32:08.549609100 +0100
> +++ gcc/testsuite/gcc.target/i386/pr84146.c     2018-02-07 17:16:37.345774290 +0100
> @@ -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];
>
>         Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]