From patchwork Thu Nov 3 11:07:04 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Georg-Johann Lay X-Patchwork-Id: 123433 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 30EADB6F70 for ; Thu, 3 Nov 2011 22:07:33 +1100 (EST) Received: (qmail 21024 invoked by alias); 3 Nov 2011 11:07:31 -0000 Received: (qmail 21011 invoked by uid 22791); 3 Nov 2011 11:07:29 -0000 X-SWARE-Spam-Status: No, hits=-0.6 required=5.0 tests=AWL, BAYES_40, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_NONE X-Spam-Check-By: sourceware.org Received: from mo-p00-ob.rzone.de (HELO mo-p00-ob.rzone.de) (81.169.146.161) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 03 Nov 2011 11:07:15 +0000 X-RZG-AUTH: :LXoWVUeid/7A29J/hMvvT2k715jHQaJercGObUOFkj18odoYNahU4Q== X-RZG-CLASS-ID: mo00 Received: from [192.168.0.22] (business-188-111-022-002.static.arcor-ip.net [188.111.22.2]) by smtp.strato.de (fruni mo62) (RZmta 26.10 AUTH) with ESMTPA id v03f57nA39rOMn ; Thu, 3 Nov 2011 12:07:06 +0100 (MET) Message-ID: <4EB275D8.5070209@gjlay.de> Date: Thu, 03 Nov 2011 12:07:04 +0100 From: Georg-Johann Lay User-Agent: Thunderbird 2.0.0.24 (X11/20100302) MIME-Version: 1.0 To: gcc-patches@gcc.gnu.org CC: Paolo Bonzini Subject: [Patch]: Fix PR rtl-optimization/50448 X-IsSubscribed: yes 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 This is a patch as proposed by paolo to fix a missing propagaton of const-int addresses. Bootstrapped and regression tested on i686-pc-linux-gnu. Ok for trunk? Johann PR rtl-optimization/50448 * cprop.c (try_replace_reg): Try to simplify SET_SRC given the substitution. Index: cprop.c =================================================================== --- cprop.c (revision 180654) +++ cprop.c (working copy) @@ -764,6 +764,18 @@ try_replace_reg (rtx from, rtx to, rtx i note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src)); } + if (set && MEM_P (SET_DEST (set)) && reg_mentioned_p (from, SET_DEST (set))) + { + /* If above failed and this is a single set, try to simplify the source of + the set given our substitution. We could perhaps try this for multiple + SETs, but it probably won't buy us anything. */ + rtx addr = simplify_replace_rtx (SET_DEST (set), from, to); + + if (!rtx_equal_p (addr, SET_DEST (set)) + && validate_change (insn, &SET_DEST (set), addr, 0)) + success = 1; + } + /* REG_EQUAL may get simplified into register. We don't allow that. Remove that note. This code ought not to happen, because previous code ought to synthesize