From patchwork Sat May 18 03:53:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Law X-Patchwork-Id: 244729 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]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "localhost", Issuer "www.qmailtoaster.com" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 0E35C2C007E for ; Sat, 18 May 2013 13:53:40 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; q=dns; s=default; b=JjMeTVuhd/Q5tu6dg CC9mp9zXwQJMfJ68ZC4Bq/L7dqLubeyOWG3SACaYeZDG9KQlrxzYu2QDKxNCjTl0 D1nR7Yqen4T219BQBqLYvnGoRuPbyHa8nZLm2yOW832zwtOEvpEIioegWpjp6ne/ P8MgYTKHgSUczzxYAh0yaEoR4g= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :message-id:date:from:mime-version:to:cc:subject:references :in-reply-to:content-type; s=default; bh=0EdHA3k3WQYb+h+IgPtxUGa i7kI=; b=U8NQWrl1iMywepk6ssHtmx5b2mcOLcRrGS2sdNEZnpEqNdMfQg9uIYz zk3ew/Adzovi5fxGTxqumlG83Rp9b7CUVVHamFMnJaDj4tWzdi/5qApX27gLYRpL 4p9wdgviqVUnswqkm1eA8L36m+ZyIhTm1HnbmzZatkwXSOAfQg5w= Received: (qmail 24883 invoked by alias); 18 May 2013 03:53:33 -0000 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 Received: (qmail 24866 invoked by uid 89); 18 May 2013 03:53:31 -0000 X-Spam-SWARE-Status: No, score=-7.7 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS, TW_SV autolearn=ham version=3.3.1 Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.84/v0.84-167-ge50287c) with ESMTP; Sat, 18 May 2013 03:53:30 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4I3rR74005397 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 17 May 2013 23:53:28 -0400 Received: from stumpy.slc.redhat.com (ovpn-113-177.phx2.redhat.com [10.3.113.177]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r4I3rQN7003334; Fri, 17 May 2013 23:53:27 -0400 Message-ID: <5196FB36.2000101@redhat.com> Date: Fri, 17 May 2013 21:53:26 -0600 From: Jeff Law User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130402 Thunderbird/17.0.5 MIME-Version: 1.0 To: Julian Brown CC: gcc-patches@gcc.gnu.org, Steven Bosscher Subject: Re: [PATCH] Fix latent bug in RTL GCSE/PRE (PR57159) References: <20130503141019.391ca3f4@octopus> <5187EE10.6010201@redhat.com> <20130507160550.0a8f702f@octopus> In-Reply-To: <20130507160550.0a8f702f@octopus> X-Virus-Found: No On 05/07/2013 09:05 AM, Julian Brown wrote: > On Mon, 6 May 2013 11:53:20 -0600 > > I don't know. My assumption was that a "simple" mem would be one that > the PRE pass could handle -- that clause was intended to handle simple > mems in REG_EQUAL notes the same as simple mems as the source of a set. > Maybe that is not safe though, and it would be better to > unconditionally invalidate buried mems in REG_EQUAL notes? I was > slightly wary of inhibiting genuine optimisation opportunities. For a simple mem, we'll do the right thing, at least that's my reading of the code. I went ahead and put the two code fragments together and committed the change after a bootstrap and regression test on x86_64-unknown-linux-gnu. For reference, attached is the patch that ultimately went into the tree. Thanks, Jeff commit f473eb72a23bc82db0ee23e51fdd40b20417fb15 Author: law Date: Sat May 18 03:48:18 2013 +0000 * gcse.c (compute_ld_motion_mems): If a non-simple MEM is found in a REG_EQUAL note, invalidate it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199049 138bc75d-0d04-0410-961f-82ee72b054a4 diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4536e62..d6eab5f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2013-05-17 Julian Brown + + * gcse.c (compute_ld_motion_mems): If a non-simple MEM is + found in a REG_EQUAL note, invalidate it. + 2013-05-17 Easwaran Raman * tree-ssa-reassoc.c (find_insert_point): New function. diff --git a/gcc/gcse.c b/gcc/gcse.c index 07043f7..e485985 100644 --- a/gcc/gcse.c +++ b/gcc/gcse.c @@ -3894,6 +3894,8 @@ compute_ld_motion_mems (void) { rtx src = SET_SRC (PATTERN (insn)); rtx dest = SET_DEST (PATTERN (insn)); + rtx note = find_reg_equal_equiv_note (insn); + rtx src_eq; /* Check for a simple LOAD... */ if (MEM_P (src) && simple_mem (src)) @@ -3910,6 +3912,15 @@ compute_ld_motion_mems (void) invalidate_any_buried_refs (src); } + if (note != 0 && REG_NOTE_KIND (note) == REG_EQUAL) + src_eq = XEXP (note, 0); + else + src_eq = NULL_RTX; + + if (src_eq != NULL_RTX + && !(MEM_P (src_eq) && simple_mem (src_eq))) + invalidate_any_buried_refs (src_eq); + /* Check for stores. Don't worry about aliased ones, they will block any movement we might do later. We only care about this exact pattern since those are the only