From patchwork Wed Feb 7 22:36:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jakub Jelinek X-Patchwork-Id: 870751 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-472822-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="NEYZIoxq"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3zcRv54fNjz9t2f for ; Thu, 8 Feb 2018 16:43:28 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; q=dns; s=default; b=jcGooRvN31b+zb+Kdlr4Gv4l6GXc5 BOV1nPcw2fgFGTyzgDHM0lut/gdNS0k5fFn1vpTOvcEO5pqFiWBZOOLydKeey9oL VppSENBINTLKDCcZaOU5BTiIg5M2HyKKEtifRF6qImdJZHFexbmlS/hww7wNBXzQ MOMgjtaOk83+V8= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:cc:subject:message-id:reply-to:mime-version :content-type; s=default; bh=5MuYHWa0QP6FaxXzGiI4K4TeIyY=; b=NEY ZIoxqysWxfcHfacVJ0ul118JGjCPu9kv9xH+uBBHfKRAS32661g9NGpSqvMuzxAF Kt8pIzww2jRdksb6ZracGgRu08CJpLWQFZcZXOiPHs6p5bfmeBuK15e7QHMc8MX6 qDxUgtupzmp19iud4ahkneNx6ycCBgimuggxrNwQ= Received: (qmail 15075 invoked by alias); 8 Feb 2018 05:43:20 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Received: (qmail 15065 invoked by uid 89); 8 Feb 2018 05:43:20 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.1 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_LOW, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=acti, sticking X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 08 Feb 2018 05:43:16 +0000 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 59DF117CEDE for ; Thu, 8 Feb 2018 05:43:09 +0000 (UTC) Received: from tucnak.zalov.cz (ovpn-117-22.ams2.redhat.com [10.36.117.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8C5BC2024CA2 for ; Thu, 8 Feb 2018 05:43:05 +0000 (UTC) Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.15.2/8.15.2) with ESMTP id w17Mb0Jx006843; Wed, 7 Feb 2018 23:37:00 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.15.2/8.15.2/Submit) id w17MawfX006842; Wed, 7 Feb 2018 23:36:58 +0100 Date: Wed, 7 Feb 2018 23:36:58 +0100 From: Jakub Jelinek To: Richard Biener , Jeff Law , Alexandre Oliva Cc: gcc-patches@gcc.gnu.org Subject: [PATCH] Fix -fcompare-debug failure on pr84146.c (PR target/84146) Message-ID: <20180207223658.GT5867@tucnak> Reply-To: Jakub Jelinek MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.9.1 (2017-09-22) X-IsSubscribed: yes 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 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. Jakub --- 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 (); - 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];