From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 66134 invoked by alias); 21 Apr 2015 12:49:26 -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 66097 invoked by uid 89); 21 Apr 2015 12:49:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 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 (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 21 Apr 2015 12:49:25 +0000 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t3LCnGte013856 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Tue, 21 Apr 2015 08:49:23 -0400 Received: from tucnak.zalov.cz (ovpn-116-37.ams2.redhat.com [10.36.116.37]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t3LCUGJm024807 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 21 Apr 2015 08:30:17 -0400 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t3LCUFNP007840; Tue, 21 Apr 2015 14:30:15 +0200 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t3LCUFWf007839; Tue, 21 Apr 2015 14:30:15 +0200 Date: Tue, 21 Apr 2015 12:49:00 -0000 From: Jakub Jelinek To: gcc-patches@gcc.gnu.org, Alexandre Oliva Subject: Re: [Patch] pr65779 - [5/6 Regression] undefined local symbol on powerpc Message-ID: <20150421123015.GU1725@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <20150420031049.GB12627@bubble.grove.modra.org> <20150420073507.GA1725@tucnak.redhat.com> <20150420084226.GC12627@bubble.grove.modra.org> <20150420085556.GE1725@tucnak.redhat.com> <20150420130032.GD12627@bubble.grove.modra.org> <20150420131721.GH1725@tucnak.redhat.com> <20150421113804.GH12627@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150421113804.GH12627@bubble.grove.modra.org> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-04/txt/msg01148.txt.bz2 On Tue, Apr 21, 2015 at 09:08:04PM +0930, Alan Modra wrote: > + if (DEBUG_INSN_P (dinsn) > + && insn_uses_reg (dinsn, dregno, end_dregno)) > + { > + if (live_bbs.is_empty ()) > + /* Put debug info for the insn we'll be moving > + into the destination block. */ > + { > + rtx_insn *newdinsn > + = emit_debug_insn_after (copy_rtx (PATTERN (dinsn)), > + bb_note (bb)); > + df_insn_rescan (newdinsn); > + } This isn't safe. There could be a debug_insn for the same decl anywhere in between the dinsn and bb_note (bb) on the chosen live path, if there is, this change will break stuff. > + /* If the insn is a simple reg-reg copy, then reset > + the debug insn to point to src. */ > + if (REG_P (src) && GET_MODE (src) == GET_MODE (dest)) > + { > + INSN_VAR_LOCATION_LOC (dinsn) > + = simplify_replace_rtx (INSN_VAR_LOCATION_LOC (dinsn), > + dest, src); > + df_insn_rescan (dinsn); > + } > + else > + { > + /* Otherwise remove anything about this variable. */ > + INSN_VAR_LOCATION_LOC (dinsn) > + = gen_rtx_UNKNOWN_VAR_LOC (); > + df_insn_rescan_debug_internal (dinsn); > + } This works (though the simplify_replace_rtx alone is dangerous, you'd better use propagate_for_debug), but is unnecessarily limitting. You could just insert a debug insn with a debug temp before the original insn and replace all the uses of the reg with the debug temporary. And, as you are walking all the bbs on the path insn by insn anyway, supposedly you could instead use the valtrack APIs for that. Thus, call dead_debug_local_init (&debug, NULL, NULL); before walking the first bb, then call dead_debug_add on each FOR_EACH_INSN_INFO_USE of the debug insns that overlaps the dest REG, and finally dead_debug_insert_temp with DEBUG_TEMP_BEFORE_WITH_VALUE and finally dead_debug_local_finish. Of course all this guarded with MAY_HAVE_DEBUG_INSNS. Jakub