From patchwork Tue Nov 8 13:11:45 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joern Rennecke X-Patchwork-Id: 124360 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id DD82D1007D3 for ; Wed, 9 Nov 2011 00:12:04 +1100 (EST) Received: (qmail 22422 invoked by alias); 8 Nov 2011 13:12:00 -0000 Received: (qmail 22154 invoked by uid 22791); 8 Nov 2011 13:11:58 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL, BAYES_00, MIME_QP_LONG_LINE X-Spam-Check-By: sourceware.org Received: from c60.cesmail.net (HELO c60.cesmail.net) (216.154.195.49) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 08 Nov 2011 13:11:46 +0000 Received: from unknown (HELO epsilon2) ([192.168.1.60]) by c60.cesmail.net with ESMTP; 08 Nov 2011 08:11:45 -0500 Received: from host-92-29-210-76.as13285.net (host-92-29-210-76.as13285.net [92.29.210.76]) by webmail.spamcop.net (Horde MIME library) with HTTP; Tue, 08 Nov 2011 08:11:45 -0500 Message-ID: <20111108081145.k697g6oymos8c4so-nzlynne@webmail.spamcop.net> Date: Tue, 08 Nov 2011 08:11:45 -0500 From: Joern Rennecke To: Kaz Kojima Cc: gcc-patches@gcc.gnu.org Subject: Re: RFT: Fix PR middle/end-40154 References: <00264351905752@mail.embecosm.com> <20111108.211651.151281633.kkojima@rr.iij4u.or.jp> In-Reply-To: <20111108.211651.151281633.kkojima@rr.iij4u.or.jp> MIME-Version: 1.0 User-Agent: Internet Messaging Program (IMP) H3 (4.1.4) 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 Quoting Kaz Kojima : > It seems that find_reloads calls set_unique_reg_note for > a USE insn. That's true, and it is by design. This use of set_unique_reg_note is a bit debatable - add_reg_note should do just fine there. OTOH keeping this as it is, and keeping set_unique_reg_note accepting USE in this case, seems more conservative for stage3. 2011-11-07 Joern Rennecke * emit-rtl.c (set_unique_reg_note): Don't add notes that disagree with the SET_DEST of INSN. Index: trunk/gcc/emit-rtl.c =================================================================== --- trunk/gcc/emit-rtl.c (revision 181122) +++ trunk/gcc/emit-rtl.c (working copy) @@ -4951,8 +4951,32 @@ rtx set_unique_reg_note (rtx insn, enum reg_note kind, rtx datum) { - rtx note = find_reg_note (insn, kind, NULL_RTX); + rtx set, note; + enum machine_mode mode; + /* Sometimes the value is calculated with some SUBREG tricks, so the + SET_DEST of INSN ends up with a different mode then DATUM. */ + set = single_set (insn); + if (set) + { + mode = GET_MODE (SET_DEST (set)); + /* If DATUM is too narrow, we can't make it fit. */ + if ((GET_MODE (datum) != VOIDmode || GET_MODE_CLASS (mode) != MODE_INT) + && GET_MODE_SIZE (mode) > GET_MODE_SIZE (GET_MODE (datum))) + return NULL_RTX; + if (GET_MODE (datum) != VOIDmode && GET_MODE (datum) != mode) + { + /* Adjust DATUM to the SET_DEST. */ + datum = simplify_gen_subreg (mode, datum, GET_MODE (datum), 0); + if (!datum) + return NULL_RTX; + } + } + else /* Reload uses USEs with REG_EQUAL notes attached to keep track of + reload inhertiance opportunities. */ + gcc_assert (PATTERN (insn) == USE && reload_in_progress); + note = find_reg_note (insn, kind, NULL_RTX); + switch (kind) { case REG_EQUAL: