From patchwork Fri Jan 6 17:05:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Aldy Hernandez X-Patchwork-Id: 134686 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 B997FB6F67 for ; Sat, 7 Jan 2012 04:05:27 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1326474328; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject: References:In-Reply-To:Content-Type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=5odgs1gTgeVATeHPJJeHW+kmK/o=; b=N/3sPXvZdVKGQAS pHsOBMBfgtuEwDS4mJRiTyBm1vsLPuTWnIm4+QOQN+/Keff+sWLjcNViCx/UesCy nhvq3JLqKfsanPFWokmeOh0QmsEf2X7npzuJveyt1nmOEis9E4ISAHy9SK94h4pC y1Tskr0wYec4W81uZQZuVD1sxKQo= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Date:From:User-Agent:MIME-Version:To:CC:Subject:References:In-Reply-To:Content-Type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ktEQHA2/nRZVUI15nfnuNmiegqwioqZKHwAf+IYfTpJkuCRDEW5CGBUw4u1vE1 PC7hQ6L689HgucjogMqF1LpvFIj1YKlzQMJkm0Xn9MiARlZlZ115zifJicyI8Q7Q gF17LIawObjLFkulb8+jguqYdHQLGTuQfVl08wnadDgPE=; Received: (qmail 30933 invoked by alias); 6 Jan 2012 17:05:21 -0000 Received: (qmail 30923 invoked by uid 22791); 6 Jan 2012 17:05:19 -0000 X-SWARE-Spam-Status: No, hits=-6.7 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 06 Jan 2012 17:05:04 +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 q06H54V9015701 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 6 Jan 2012 12:05:04 -0500 Received: from houston.quesejoda.com (vpn-11-227.rdu.redhat.com [10.11.11.227]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q06H534U020273; Fri, 6 Jan 2012 12:05:03 -0500 Message-ID: <4F0729BF.60709@redhat.com> Date: Fri, 06 Jan 2012 11:05:03 -0600 From: Aldy Hernandez User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0 MIME-Version: 1.0 To: Richard Guenther CC: gcc-patches Subject: Re: patch: remove is_gimple_non_addressable References: <4F05B833.7000907@redhat.com> In-Reply-To: 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 On 01/05/12 09:36, Richard Guenther wrote: > On Thu, Jan 5, 2012 at 3:48 PM, Aldy Hernandez wrote: >> As you suggested here: >> >> http://gcc.gnu.org/ml/gcc-patches/2012-01/msg00232.html >> >> Bootregged on x86-64 Linux. >> >> OK? > > No, this pessimizes things too much at gimplification time, please simply > inline the predicate instead. > > Richard. It wasn't clear from your other message whether you want me to replace the call with: !is_gimple_reg () && !TREE_ADDRESSABLE () or outright inline the exact function call as we have now. I have done the later. Let me know if you want the former. Tested on x86-64 Linux. OK? * gimple.c (is_gimple_non_addressable): Remove. * gimple.h: Remove is_gimple_non_addressable. * gimplify.c (gimplify_modify_expr_rhs): Use is_gimple_reg instead of is_gimple_non_addressable. * trans-mem.c (expand_assign_tm): Same. Index: trans-mem.c =================================================================== --- trans-mem.c (revision 182908) +++ trans-mem.c (working copy) @@ -2184,7 +2184,7 @@ expand_assign_tm (struct tm_region *regi /* ??? Figure out if there's any possible overlap between the LHS and the RHS and if not, use MEMCPY. */ - if (load_p && is_gimple_non_addressable (lhs)) + if (load_p && is_gimple_reg (lhs)) { tmp = create_tmp_var (TREE_TYPE (lhs), NULL); lhs_addr = build_fold_addr_expr (tmp); Index: gimplify.c =================================================================== --- gimplify.c (revision 182848) +++ gimplify.c (working copy) @@ -4411,16 +4411,27 @@ gimplify_modify_expr_rhs (tree *expr_p, /* It's OK to use the target directly if it's being initialized. */ use_target = true; - else if (!is_gimple_non_addressable (*to_p)) - /* Don't use the original target if it's already addressable; - if its address escapes, and the called function uses the - NRV optimization, a conforming program could see *to_p - change before the called function returns; see c++/19317. - When optimizing, the return_slot pass marks more functions - as safe after we have escape info. */ - use_target = false; else - use_target = true; + { + tree t; + + if (TREE_CODE (*to_p) == SSA_NAME) + t = SSA_NAME_VAR (*to_p); + else + t = *to_p; + if (!is_gimple_variable (t) || needs_to_live_in_memory (t)) + /* Don't use the original target if it's already + addressable; if its address escapes, and the + called function uses the NRV optimization, a + conforming program could see *to_p change + before the called function returns; see + c++/19317. When optimizing, the return_slot + pass marks more functions as safe after we have + escape info. */ + use_target = false; + else + use_target = true; + } if (use_target) { Index: gimple.c =================================================================== --- gimple.c (revision 182848) +++ gimple.c (working copy) @@ -2963,17 +2963,6 @@ is_gimple_reg (tree t) } -/* Return true if T is a GIMPLE variable whose address is not needed. */ - -bool -is_gimple_non_addressable (tree t) -{ - if (TREE_CODE (t) == SSA_NAME) - t = SSA_NAME_VAR (t); - - return (is_gimple_variable (t) && ! needs_to_live_in_memory (t)); -} - /* Return true if T is a GIMPLE rvalue, i.e. an identifier or a constant. */ bool Index: gimple.h =================================================================== --- gimple.h (revision 182848) +++ gimple.h (working copy) @@ -1006,9 +1006,6 @@ extern bool is_gimple_mem_rhs (tree); /* Returns true iff T is a valid if-statement condition. */ extern bool is_gimple_condexpr (tree); -/* Returns true iff T is a variable that does not need to live in memory. */ -extern bool is_gimple_non_addressable (tree t); - /* Returns true iff T is a valid call address expression. */ extern bool is_gimple_call_addr (tree);