From patchwork Wed Oct 20 19:03:59 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pat Haugen X-Patchwork-Id: 68465 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 5CA68B70A5 for ; Thu, 21 Oct 2010 06:04:12 +1100 (EST) Received: (qmail 1441 invoked by alias); 20 Oct 2010 19:04:10 -0000 Received: (qmail 1433 invoked by uid 22791); 20 Oct 2010 19:04:10 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from e39.co.us.ibm.com (HELO e39.co.us.ibm.com) (32.97.110.160) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 20 Oct 2010 19:04:04 +0000 Received: from d03relay05.boulder.ibm.com (d03relay05.boulder.ibm.com [9.17.195.107]) by e39.co.us.ibm.com (8.14.4/8.13.1) with ESMTP id o9KIr64Z007809 for ; Wed, 20 Oct 2010 12:53:06 -0600 Received: from d03av01.boulder.ibm.com (d03av01.boulder.ibm.com [9.17.195.167]) by d03relay05.boulder.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o9KJ3wuc121676 for ; Wed, 20 Oct 2010 13:03:59 -0600 Received: from d03av01.boulder.ibm.com (loopback [127.0.0.1]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o9KJ3wHP009610 for ; Wed, 20 Oct 2010 13:03:58 -0600 Received: from [127.0.0.1] (t61-pth.rchland.ibm.com [9.10.86.65]) by d03av01.boulder.ibm.com (8.14.4/8.13.1/NCO v10.0 AVin) with ESMTP id o9KJ3vxe009524; Wed, 20 Oct 2010 13:03:57 -0600 Message-ID: <4CBF3D1F.3090901@linux.vnet.ibm.com> Date: Wed, 20 Oct 2010 14:03:59 -0500 From: Pat Haugen User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4 MIME-Version: 1.0 To: Richard Guenther CC: Eric Botcazou , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Modify TER to not propagate expressions across call References: <4C8A90C5.4020306@linux.vnet.ibm.com> <201010180918.34483.ebotcazou@adacore.com> <4CBCC750.3030408@linux.vnet.ibm.com> In-Reply-To: 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 On 10/19/2010 5:21 AM, Richard Guenther wrote: > On Tue, Oct 19, 2010 at 12:16 AM, Pat Haugen > wrote: >> On 10/18/2010 4:33 AM, Richard Guenther wrote: >>>> The NOT operation used to be propagated into the AND operation; it isn't >>>> any >>>> more after the patch. Now this propagation was a complete win: an SSA >>>> name >>>> was eliminated and lifetimes didn't change globally. >>>> >>>> Could the patch be tweaked so as to fix the pessimization this case? >>> We could allow the TER if the operation just has a single operand as >>> that doesn't pessimize register allocation across calls >> The following appears to work, if it's the right approach I can >> bootstrap/regtest. > Yes, that looks good. Please fix formatting problems while you > are there (|| and&& go on the next line, watch long lines). > Bootstrap/regtest went fine. Fixed the formatting problems and committed the following as rev 165733. 2010-10-20 Pat Haugen * tree-ssa-ter.c (find_replaceable_in_bb): Allow replacement over call for single operand expression. else mark_replaceable (tab, use, stmt_replaceable); Index: gcc/tree-ssa-ter.c =================================================================== --- gcc/tree-ssa-ter.c (revision 165699) +++ gcc/tree-ssa-ter.c (working copy) @@ -644,8 +644,10 @@ find_replaceable_in_bb (temp_expr_table_ def variable has the same root variable as something in the substitution list, or the def and use span a call such that we'll expand lifetimes across a call. */ - if (gimple_has_volatile_ops (stmt) || same_root_var || - tab->call_cnt[ver] != cur_call_cnt) + if (gimple_has_volatile_ops (stmt) || same_root_var + || (tab->call_cnt[ver] != cur_call_cnt + && SINGLE_SSA_USE_OPERAND (SSA_NAME_DEF_STMT (use), SSA_OP_USE) + == NULL_USE_OPERAND_P)) finished_with_expr (tab, ver, true);