From patchwork Sun Nov 15 11:05:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tom de Vries X-Patchwork-Id: 544820 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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id C9FB01402B6 for ; Sun, 15 Nov 2015 22:06:15 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=BKqqYeRY; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; q=dns; s=default; b=nxAQvchmkI/eCEyMQ zJBWAiQGN8oHG0WeCWmG+vLUmhi2HnDZ8U6WLX8kc06OxftOn0R7A63dEjOSb+De KIcoZqpPndWdF7YIsYIOKj3mA4nq3RSmTfd35X6EmSFMFCuceV8PBYUmJ2sTUlac I30CmdFkcWkgb82dZREWlxvePI= 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 :subject:to:references:cc:from:message-id:date:mime-version :in-reply-to:content-type; s=default; bh=UedhMO1xhtJ7bXrAu4LU6Of 9y0E=; b=BKqqYeRYLLdf676hNLVuLp1U82Gdfk90+PfYUNVTnO2+aSqOQPWe0K5 j9U0czEvKu5qqf0Wyg/vBHA6/lsrq8m0GSJYcJU2rSbWHb2lQGlBnxfck0xRSl+y TodvjiTE48cgy9LIWqweJ7lrrghH0mKMIZqjEJpyZo+gd4HALaHk= Received: (qmail 18049 invoked by alias); 15 Nov 2015 11:06:09 -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 18038 invoked by uid 89); 15 Nov 2015 11:06:07 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_PASS autolearn=ham version=3.3.2 X-HELO: fencepost.gnu.org Received: from fencepost.gnu.org (HELO fencepost.gnu.org) (208.118.235.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Sun, 15 Nov 2015 11:06:06 +0000 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45849) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1Zxv8F-0001nR-Vk for gcc-patches@gnu.org; Sun, 15 Nov 2015 06:06:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zxv8A-0000L0-N3 for gcc-patches@gnu.org; Sun, 15 Nov 2015 06:06:03 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:58081) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zxv8A-0000Kv-Ec for gcc-patches@gnu.org; Sun, 15 Nov 2015 06:05:58 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1Zxv89-0000BO-Kj from Tom_deVries@mentor.com ; Sun, 15 Nov 2015 03:05:57 -0800 Received: from [127.0.0.1] (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Sun, 15 Nov 2015 11:05:56 +0000 Subject: [PATCH, 5/6] Remove first_pass_instance from pass_ccp To: Richard Biener References: <56447A09.4070608@mentor.com> <564498CE.5010207@mentor.com> <1447342432.7830.21.camel@surprise> <5645EC5A.9060005@mentor.com> <5646FC85.2060802@mentor.com> <564864AA.6000101@mentor.com> CC: David Malcolm , "gcc-patches@gnu.org" From: Tom de Vries Message-ID: <564866F2.9050205@mentor.com> Date: Sun, 15 Nov 2015 12:05:22 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <564864AA.6000101@mentor.com> X-detected-operating-system: by eggs.gnu.org: Windows NT kernel [generic] [fuzzy] X-Received-From: 192.94.38.131 On 15/11/15 11:55, Tom de Vries wrote: > [ was: Re: [PATCH] Remove first_pass_instance from pass_vrp ] > > This patch series removes first_pass_instance. > > 1 Remove first_pass_instance from pass_vrp > 2 Remove first_pass_instance from pass_reassoc > 3 Remove first_pass_instance from pass_dominator > 4 Remove first_pass_instance from pass_object_sizes > 5 Remove first_pass_instance from pass_ccp > 6 Remove first_pass_instance > > Bootstrapped and reg-tested on x86_64. > > I will post the individual patches in reply to this email. > > [ I won't post the first patch though. It was already posted here: > https://gcc.gnu.org/ml/gcc-patches/2015-11/msg01701.html . ] this patch removes first_pass_instance from pass_ccp. Thanks, - Tom Remove first_pass_instance from pass_ccp 2015-11-15 Tom de Vries * passes.def: Add arg to pass_ccp pass instantiation. * tree-ssa-ccp.c (ccp_finalize): Add param nonzero_p. Use nonzero_p instead of first_pass_instance. (do_ssa_ccp): Add and handle param nonzero_p. (pass_ccp::pass_ccp): Initialize nonzero_p. (pass_ccp::set_pass_param): New member function. Set nonzero_p. (pass_ccp::execute): Call do_ssa_ccp with extra arg. (pass_ccp::nonzero_p): New private member. --- gcc/passes.def | 10 ++++++---- gcc/tree-ssa-ccp.c | 27 +++++++++++++++++---------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/gcc/passes.def b/gcc/passes.def index 64883a7..17027786 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -78,7 +78,9 @@ along with GCC; see the file COPYING3. If not see PUSH_INSERT_PASSES_WITHIN (pass_all_early_optimizations) NEXT_PASS (pass_remove_cgraph_callee_edges); NEXT_PASS (pass_object_sizes, true /* insert_min_max_p */); - NEXT_PASS (pass_ccp); + /* Don't record nonzero bits before IPA to avoid + using too much memory. */ + NEXT_PASS (pass_ccp, false /* nonzero_p */); /* After CCP we rewrite no longer addressed locals into SSA form if possible. */ NEXT_PASS (pass_forwprop); @@ -157,7 +159,7 @@ along with GCC; see the file COPYING3. If not see /* Initial scalar cleanups before alias computation. They ensure memory accesses are not indirect wherever possible. */ NEXT_PASS (pass_strip_predict_hints); - NEXT_PASS (pass_ccp); + NEXT_PASS (pass_ccp, true /* nonzero_p */); /* After CCP we rewrite no longer addressed locals into SSA form if possible. */ NEXT_PASS (pass_complete_unrolli); @@ -209,7 +211,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_dce); NEXT_PASS (pass_forwprop); NEXT_PASS (pass_phiopt); - NEXT_PASS (pass_ccp); + NEXT_PASS (pass_ccp, true /* nonzero_p */); /* After CCP we rewrite no longer addressed locals into SSA form if possible. */ NEXT_PASS (pass_cse_sincos); @@ -319,7 +321,7 @@ along with GCC; see the file COPYING3. If not see NEXT_PASS (pass_lower_complex); NEXT_PASS (pass_lower_vector_ssa); /* Perform simple scalar cleanup which is constant/copy propagation. */ - NEXT_PASS (pass_ccp); + NEXT_PASS (pass_ccp, true /* nonzero_p */); NEXT_PASS (pass_object_sizes); /* Fold remaining builtins. */ NEXT_PASS (pass_fold_builtins); diff --git a/gcc/tree-ssa-ccp.c b/gcc/tree-ssa-ccp.c index d09fab1..b845a7b 100644 --- a/gcc/tree-ssa-ccp.c +++ b/gcc/tree-ssa-ccp.c @@ -886,12 +886,12 @@ do_dbg_cnt (void) /* Do final substitution of propagated values, cleanup the flowgraph and - free allocated storage. + free allocated storage. If NONZERO_P, record nonzero bits. Return TRUE when something was optimized. */ static bool -ccp_finalize (void) +ccp_finalize (bool nonzero_p) { bool something_changed; unsigned i; @@ -910,9 +910,7 @@ ccp_finalize (void) if (!name || (!POINTER_TYPE_P (TREE_TYPE (name)) && (!INTEGRAL_TYPE_P (TREE_TYPE (name)) - /* Don't record nonzero bits before IPA to avoid - using too much memory. */ - || first_pass_instance))) + || !nonzero_p))) continue; val = get_value (name); @@ -2394,16 +2392,17 @@ ccp_visit_stmt (gimple *stmt, edge *taken_edge_p, tree *output_p) } -/* Main entry point for SSA Conditional Constant Propagation. */ +/* Main entry point for SSA Conditional Constant Propagation. If NONZERO_P, + record nonzero bits. */ static unsigned int -do_ssa_ccp (void) +do_ssa_ccp (bool nonzero_p) { unsigned int todo = 0; calculate_dominance_info (CDI_DOMINATORS); ccp_initialize (); ssa_propagate (ccp_visit_stmt, ccp_visit_phi_node); - if (ccp_finalize ()) + if (ccp_finalize (nonzero_p)) todo = (TODO_cleanup_cfg | TODO_update_ssa); free_dominance_info (CDI_DOMINATORS); return todo; @@ -2429,14 +2428,22 @@ class pass_ccp : public gimple_opt_pass { public: pass_ccp (gcc::context *ctxt) - : gimple_opt_pass (pass_data_ccp, ctxt) + : gimple_opt_pass (pass_data_ccp, ctxt), nonzero_p (false) {} /* opt_pass methods: */ opt_pass * clone () { return new pass_ccp (m_ctxt); } + void set_pass_param (unsigned int n, bool param) + { + gcc_assert (n == 0); + nonzero_p = param; + } virtual bool gate (function *) { return flag_tree_ccp != 0; } - virtual unsigned int execute (function *) { return do_ssa_ccp (); } + virtual unsigned int execute (function *) { return do_ssa_ccp (nonzero_p); } + private: + /* Determines whether the pass instance records nonzero bits. */ + bool nonzero_p; }; // class pass_ccp } // anon namespace