From patchwork Wed Sep 23 16:05:14 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kyrylo Tkachov X-Patchwork-Id: 54056 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f71.google.com (mail-la0-f71.google.com [209.85.215.71]) by patches.linaro.org (Postfix) with ESMTPS id C2A7722B1E for ; Wed, 23 Sep 2015 16:05:37 +0000 (UTC) Received: by lacao8 with SMTP id ao8sf14929160lac.3 for ; Wed, 23 Sep 2015 09:05:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:mailing-list:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:sender :delivered-to:message-id:date:from:user-agent:mime-version:to :subject:content-type:x-original-sender :x-original-authentication-results; bh=7b2WCr7dDVt2ZPvfMviDquGx81hDKKSmtg7fBN3ynjk=; b=gDWEPsZUPfM7SHdnPPjbnFfezHz5E7fkf7WM9uNu177LlnqxmGYfrEa109OaZCc44Q TOdIzm04jH6LLv3ygVAu4YTFmxDLtbbRg8EoZXx+0bSDCTpO9DlJYRBdNYUHduUw2zEp eQduS0FMR39PyJS9NzFK9U2CBXOWhsf/ZVqb5KB57P1PKql9cbdwfQHnpLvqBIteF1E5 qUwEWapeSahdJibC091+YFUQRHkdu3x6qvm7A7x6d0qH1TOepzh7vwMzfPZiGVKHiVuI POzEQSs1bWGlr2ZLCy2cACBQi0G12ErL+vYJpbb7O1hwpgn+N+7zxNS0iXD/QjfxLi5v 8vWQ== X-Gm-Message-State: ALoCoQlGwnR4izMWJKDxJ+Xt0kB/CeedUo6NMksVSUp7N0OZ+XnkhoB2lFPG/Iu2gjhwB1Tp4bj7 X-Received: by 10.152.3.131 with SMTP id c3mr5451432lac.4.1443024336300; Wed, 23 Sep 2015 09:05:36 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.10.7 with SMTP id e7ls54646lab.70.gmail; Wed, 23 Sep 2015 09:05:36 -0700 (PDT) X-Received: by 10.112.134.102 with SMTP id pj6mr6897429lbb.14.1443024336159; Wed, 23 Sep 2015 09:05:36 -0700 (PDT) Received: from mail-la0-x22a.google.com (mail-la0-x22a.google.com. [2a00:1450:4010:c03::22a]) by mx.google.com with ESMTPS id d5si4270166lah.47.2015.09.23.09.05.36 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 09:05:36 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) client-ip=2a00:1450:4010:c03::22a; Received: by lahg1 with SMTP id g1so56670217lah.1 for ; Wed, 23 Sep 2015 09:05:36 -0700 (PDT) X-Received: by 10.152.18.130 with SMTP id w2mr3023641lad.88.1443024335887; Wed, 23 Sep 2015 09:05:35 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1196195lbq; Wed, 23 Sep 2015 09:05:34 -0700 (PDT) X-Received: by 10.66.136.237 with SMTP id qd13mr38494052pab.84.1443024334286; Wed, 23 Sep 2015 09:05:34 -0700 (PDT) Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id it8si11531561pbc.103.2015.09.23.09.05.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 Sep 2015 09:05:34 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-408137-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Received: (qmail 90590 invoked by alias); 23 Sep 2015 16:05:22 -0000 Mailing-List: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org Precedence: list 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 90576 invoked by uid 89); 23 Sep 2015 16:05:21 -0000 X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, SPF_PASS autolearn=ham version=3.3.2 X-HELO: eu-smtp-delivery-143.mimecast.com Received: from eu-smtp-delivery-143.mimecast.com (HELO eu-smtp-delivery-143.mimecast.com) (146.101.78.143) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 23 Sep 2015 16:05:20 +0000 Received: from cam-owa1.Emea.Arm.com (fw-tnat.cambridge.arm.com [217.140.96.140]) by eu-smtp-1.mimecast.com with ESMTP id uk-mta-27-o14JXpA5Sfq1FcSpPwZVRQ-1; Wed, 23 Sep 2015 17:05:16 +0100 Received: from [10.2.207.50] ([10.1.2.79]) by cam-owa1.Emea.Arm.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 23 Sep 2015 17:05:14 +0100 Message-ID: <5602CDBA.8080001@arm.com> Date: Wed, 23 Sep 2015 17:05:14 +0100 From: Kyrill Tkachov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 MIME-Version: 1.0 To: GCC Patches Subject: [PATCH][tree-inline][obvious] Delete redundant count_insns_seq X-MC-Unique: o14JXpA5Sfq1FcSpPwZVRQ-1 X-IsSubscribed: yes X-Original-Sender: kyrylo.tkachov@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 2a00:1450:4010:c03::22a as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org; dkim=pass header.i=@gcc.gnu.org X-Google-Group-Id: 836684582541 Hi all, I notice that the functions count_insns_seq and estimate_num_insns_seq perform the exact same function for exactly the same arguments. It's redundant to keep both around. I've decided to delete count_insns_seq and replace its one use by estimate_num_insns_seq. Bootstrapped and tested on aarch64, x86_64. I think this change is obvious, so I'll commit it in 24 hours unless someone objects. Thanks, Kyrill 2015-09-23 Kyrylo Tkachov * tree-inline.h (count_insns_seq): Delete prototype. (estimate_num_insns_seq): Define prototype. * tree-inline.c (count_insns_seq): Delete. (estimate_num_insns_seq): Remove static qualifier. * tree-eh.c (decide_copy_try_finally): Replace use of count_insns_seq with estimate_num_insns_seq. commit b4266c4bd350628fe5d333998b7a76a7d4ab2ad5 Author: Kyrylo Tkachov Date: Wed Sep 23 12:14:46 2015 +0100 [tree-inline] Delete redundant count_insns_seq diff --git a/gcc/tree-eh.c b/gcc/tree-eh.c index c19d2be..cb1f08a 100644 --- a/gcc/tree-eh.c +++ b/gcc/tree-eh.c @@ -1621,7 +1621,7 @@ decide_copy_try_finally (int ndests, bool may_throw, gimple_seq finally) } /* Finally estimate N times, plus N gotos. */ - f_estimate = count_insns_seq (finally, &eni_size_weights); + f_estimate = estimate_num_insns_seq (finally, &eni_size_weights); f_estimate = (f_estimate + 1) * ndests; /* Switch statement (cost 10), N variable assignments, N gotos. */ diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index abaea3f..36075b2 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -3972,8 +3972,8 @@ estimate_operator_cost (enum tree_code code, eni_weights *weights, the statements in the statement sequence STMTS. WEIGHTS contains weights attributed to various constructs. */ -static -int estimate_num_insns_seq (gimple_seq stmts, eni_weights *weights) +int +estimate_num_insns_seq (gimple_seq stmts, eni_weights *weights) { int cost; gimple_stmt_iterator gsi; @@ -4262,19 +4262,6 @@ init_inline_once (void) eni_time_weights.return_cost = 2; } -/* Estimate the number of instructions in a gimple_seq. */ - -int -count_insns_seq (gimple_seq seq, eni_weights *weights) -{ - gimple_stmt_iterator gsi; - int n = 0; - for (gsi = gsi_start (seq); !gsi_end_p (gsi); gsi_next (&gsi)) - n += estimate_num_insns (gsi_stmt (gsi), weights); - - return n; -} - /* Install new lexical TREE_BLOCK underneath 'current_block'. */ diff --git a/gcc/tree-inline.h b/gcc/tree-inline.h index f0e5436..b8fb2a2 100644 --- a/gcc/tree-inline.h +++ b/gcc/tree-inline.h @@ -207,7 +207,7 @@ tree copy_decl_no_change (tree decl, copy_body_data *id); int estimate_move_cost (tree type, bool); int estimate_num_insns (gimple *, eni_weights *); int estimate_num_insns_fn (tree, eni_weights *); -int count_insns_seq (gimple_seq, eni_weights *); +int estimate_num_insns_seq (gimple_seq, eni_weights *); bool tree_versionable_function_p (tree); extern tree remap_decl (tree decl, copy_body_data *id); extern tree remap_type (tree type, copy_body_data *id);