From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48107 invoked by alias); 20 Dec 2016 14:39:03 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 48093 invoked by uid 89); 20 Dec 2016 14:39:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-5.0 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 spammy=trial, H*i:sk:c053968, H*f:sk:c053968, H*MI:sk:c053968 X-HELO: mailapp01.imgtec.com Received: from mailapp01.imgtec.com (HELO mailapp01.imgtec.com) (195.59.15.196) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 20 Dec 2016 14:38:52 +0000 Received: from HHMAIL01.hh.imgtec.org (unknown [10.100.10.19]) by Forcepoint Email with ESMTPS id 66C2D17C8B1E3 for ; Tue, 20 Dec 2016 14:38:46 +0000 (GMT) Received: from [10.150.130.85] (10.150.130.85) by HHMAIL01.hh.imgtec.org (10.100.10.21) with Microsoft SMTP Server (TLS) id 14.3.294.0; Tue, 20 Dec 2016 14:38:48 +0000 Subject: Re: [PATCH] [PR rtl-optimization/65618] Fix MIPS ADA bootstrap failure To: References: From: James Cowgill Message-ID: Date: Tue, 20 Dec 2016 14:45:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-SW-Source: 2016-12/txt/msg01707.txt.bz2 Hi, On 19/12/16 21:43, Jeff Law wrote: > On 12/19/2016 08:44 AM, James Cowgill wrote: >> 2016-12-16 James Cowgill >> >> PR rtl-optimization/65618 >> * emit-rtl.c (try_split): Update "after" when moving a >> NOTE_INSN_CALL_ARG_LOCATION. >> >> diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c >> index 7de17454037..6be124ac038 100644 >> --- a/gcc/emit-rtl.c >> +++ b/gcc/emit-rtl.c >> @@ -3742,6 +3742,11 @@ try_split (rtx pat, rtx_insn *trial, int last) >> next = NEXT_INSN (next)) >> if (NOTE_KIND (next) == NOTE_INSN_CALL_ARG_LOCATION) >> { >> + /* Advance after to the next instruction if it is about to >> + be removed. */ >> + if (after == next) >> + after = NEXT_INSN (after); >> + >> remove_insn (next); >> add_insn_after (next, insn, NULL); >> break; >> > So the thing I don't like when looking at this code is we set AFTER > immediately upon entry to try_split. But we don't use it until near the > very end of try_split. That's just asking for trouble. > > Can we reasonably initialize AFTER just before it's used? I wasn't sure but looking closer I think that would be fine. This patch also works and does what Richard Sandiford suggested in the PR. 2016-12-20 James Cowgill PR rtl-optimization/65618 * emit-rtl.c (try_split): Move initialization of "before" and "after" to just before the call to emit_insn_after_setloc. diff --git a/gcc/emit-rtl.c b/gcc/emit-rtl.c index 7de17454037..bdc984c65cf 100644 --- a/gcc/emit-rtl.c +++ b/gcc/emit-rtl.c @@ -3643,8 +3643,7 @@ mark_label_nuses (rtx x) rtx_insn * try_split (rtx pat, rtx_insn *trial, int last) { - rtx_insn *before = PREV_INSN (trial); - rtx_insn *after = NEXT_INSN (trial); + rtx_insn *before, *after; rtx note; rtx_insn *seq, *tem; int probability; @@ -3818,6 +3817,9 @@ try_split (rtx pat, rtx_insn *trial, int last) } } + before = PREV_INSN (trial); + after = NEXT_INSN (trial); + tem = emit_insn_after_setloc (seq, trial, INSN_LOCATION (trial)); delete_insn (trial); Thanks, James