From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 62616 invoked by alias); 26 Sep 2016 16:39:32 -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 62602 invoked by uid 89); 26 Sep 2016 16:39:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=tackle, Hx-languages-length:1660 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 26 Sep 2016 16:39:21 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C565285376; Mon, 26 Sep 2016 16:39:20 +0000 (UTC) Received: from localhost.localdomain (ovpn-116-2.phx2.redhat.com [10.3.116.2]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u8QGdKYb000519; Mon, 26 Sep 2016 12:39:20 -0400 Subject: Re: [PATCH 3/5] regrename: Don't rename restores To: Segher Boessenkool , gcc-patches@gcc.gnu.org References: Cc: dje.gcc@gmail.com From: Jeff Law Message-ID: Date: Mon, 26 Sep 2016 16:44:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2016-09/txt/msg01863.txt.bz2 On 09/23/2016 02:21 AM, Segher Boessenkool wrote: > A restore is supposed to restore some certain register. Restoring it > into some other register will not work. Don't. > > > 2016-09-23 Segher Boessenkool > > * regrename.c (build_def_use): Invalidate chains that have a > REG_CFA_RESTORE on some instruction. > > --- > gcc/regrename.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/gcc/regrename.c b/gcc/regrename.c > index 54c7768..00a5d02 100644 > --- a/gcc/regrename.c > +++ b/gcc/regrename.c > @@ -1867,6 +1867,12 @@ build_def_use (basic_block bb) > scan_rtx (insn, &XEXP (note, 0), NO_REGS, terminate_dead, > OP_IN); > } > + > + /* Step 8: Kill the chains involving register restores. Those > + should restore _that_ register. */ > + for (note = REG_NOTES (insn); note; note = XEXP (note, 1)) > + if (REG_NOTE_KIND (note) == REG_CFA_RESTORE) > + scan_rtx (insn, &XEXP (note, 0), NO_REGS, mark_all_read, OP_IN); > } > else if (DEBUG_INSN_P (insn) > && !VAR_LOC_UNKNOWN_P (INSN_VAR_LOCATION_LOC (insn))) Seems like a good thing regardless of the shrink-wrapping changes. There's a comment about 200 lines earlier (egad) which outlines the steps. Can you please add a comment there too. It would probably be a good idea to refactor build_def_use a bit, but I'd understand if you don't want to tackle that. I don't think that desire should block this patch. As I've said before, I'm not sure we're getting CFA notes right, particularly on the older ports, but I don't think that should block this patch. With the earlier comment update change this is OK. jeff