From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20983 invoked by alias); 6 Jan 2015 14:08:16 -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 20969 invoked by uid 89); 6 Jan 2015 14:08:15 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_HELO_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, 06 Jan 2015 14:08:14 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t06E8AxY007224 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 6 Jan 2015 09:08:11 -0500 Received: from tucnak.zalov.cz (ovpn-116-64.ams2.redhat.com [10.36.116.64]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t06E88RA028487 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO); Tue, 6 Jan 2015 09:08:09 -0500 Received: from tucnak.zalov.cz (localhost [127.0.0.1]) by tucnak.zalov.cz (8.14.9/8.14.9) with ESMTP id t06E86KA028074; Tue, 6 Jan 2015 15:08:07 +0100 Received: (from jakub@localhost) by tucnak.zalov.cz (8.14.9/8.14.9/Submit) id t06E85oP028073; Tue, 6 Jan 2015 15:08:05 +0100 Date: Tue, 06 Jan 2015 14:08:00 -0000 From: Jakub Jelinek To: Jeff Law , John David Anglin Cc: Richard Biener , "H.J. Lu" , GCC Patches Subject: [PATCH] Fix up DSE - PR middle-end/64388, target/55023 Message-ID: <20150106140805.GK1667@tucnak.redhat.com> Reply-To: Jakub Jelinek References: <1DEC62AA-F782-423D-B110-FC1E48CC97E8@gmail.com> <54AA9D75.7050400@redhat.com> <20150105185103.GW1667@tucnak.redhat.com> <20150105212357.GY1667@tucnak.redhat.com> <20150105213117.GZ1667@tucnak.redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150105213117.GZ1667@tucnak.redhat.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-IsSubscribed: yes X-SW-Source: 2015-01/txt/msg00238.txt.bz2 Hi! On Mon, Jan 05, 2015 at 10:31:17PM +0100, Jakub Jelinek wrote: > Or you could e.g. do the > if (HARD_FRAME_POINTER_IS_ARG_POINTER > && !reload_completed > && SIBLING_CALL_P (insn)) > { add_wild_read (bb_info); return; } > case first, then compute const_call and memset_call, > if (const_call || memset_call) > { current_big_block } > else if (reload_completed && SIBLING_CALL_P (insn)) > add_wild_read (bb_info); > else > add_non_frame_wild_read (bb_info); > > That way, you would not punish const/memset calls unnecessarily after reload > when they are sibling calls. So what about this way? Even for the HARD_FRAME_POINTER_IS_ARG_POINTER before reload case, there is no reason for wild read IMHO, just setting frame_read should do all that is necessary. Bootstrapped/regtested on x86_64-linux and i686-linux, tested on the pr55023 testcase with cross to hppa-linux. Ok for trunk? 2015-01-06 Jakub Jelinek PR target/55023 PR middle-end/64388 * dse.c (struct insn_info): Mention frame_read set also before reload for tail calls on some targets. (scan_insn): Revert 2014-12-22 change. Set frame_read also before reload for tail calls if HARD_FRAME_POINTER_IS_ARG_POINTER. Call add_wild_read instead of add_non_frame_wild_read for non-const/memset tail calls after reload. --- gcc/dse.c.jj 2015-01-05 22:41:19.000000000 +0100 +++ gcc/dse.c 2015-01-06 11:39:39.450832915 +0100 @@ -371,9 +371,11 @@ struct insn_info either stack pointer or hard frame pointer based. This means that we have no other choice than also killing all the frame pointer based stores upon encountering a const function call. - This field is set after reload for const function calls. Having - this set is less severe than a wild read, it just means that all - the frame related stores are killed rather than all the stores. */ + This field is set after reload for const function calls and before + reload for const tail function calls on targets where arg pointer + is the frame pointer. Having this set is less severe than a wild + read, it just means that all the frame related stores are killed + rather than all the stores. */ bool frame_read; /* This field is only used for the processing of const functions. @@ -2483,17 +2485,6 @@ scan_insn (bb_info_t bb_info, rtx_insn * insn_info->cannot_delete = true; - /* Arguments for a sibling call that are pushed to memory are passed - using the incoming argument pointer of the current function. These - may or may not be frame related depending on the target. Since - argument pointer related stores are not currently tracked, we treat - a sibling call as though it does a wild read. */ - if (SIBLING_CALL_P (insn)) - { - add_wild_read (bb_info); - return; - } - /* Const functions cannot do anything bad i.e. read memory, however, they can read their parameters which may have been pushed onto the stack. @@ -2527,7 +2518,13 @@ scan_insn (bb_info_t bb_info, rtx_insn * const_call ? "const" : "memset", INSN_UID (insn)); /* See the head comment of the frame_read field. */ - if (reload_completed) + if (reload_completed + /* Tail calls are storing their arguments using + arg poinnter. If it is a frame pointer on the target, + even before reload we need to kill frame pointer based + stores. */ + || (SIBLING_CALL_P (insn) + && HARD_FRAME_POINTER_IS_ARG_POINTER)) insn_info->frame_read = true; /* Loop over the active stores and remove those which are @@ -2601,7 +2598,11 @@ scan_insn (bb_info_t bb_info, rtx_insn * } } } - + else if (SIBLING_CALL_P (insn) && reload_completed) + /* Arguments for a sibling call that are pushed to memory are passed + using the incoming argument pointer of the current function. After + reload that might be (and likely is) frame pointer based. */ + add_wild_read (bb_info); else /* Every other call, including pure functions, may read any memory that is not relative to the frame. */ Jakub