From patchwork Thu May 6 12:51:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1474960 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=2620:52:3:1:0:246e:9693:128c; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Received: from sourceware.org (server2.sourceware.org [IPv6:2620:52:3:1:0:246e:9693:128c]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4FbYPV0FkCz9sWk for ; Thu, 6 May 2021 22:51:56 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 78B1F3AA9911; Thu, 6 May 2021 12:51:54 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by sourceware.org (Postfix) with ESMTPS id A72CC3AA990F for ; Thu, 6 May 2021 12:51:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org A72CC3AA990F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=rguenther@suse.de X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8B39BB1EA for ; Thu, 6 May 2021 12:51:51 +0000 (UTC) Date: Thu, 6 May 2021 14:51:50 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] refactor SSA rewriting timevars Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-11.4 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces@gcc.gnu.org Sender: "Gcc-patches" This avoids too deep stacks of timevars during incremental SSA rewrite and basically use TV_TREE_INTO_SSA for all into-SSA rewrite work and TV_TREE_SSA_INCREMENTAL for update_ssa. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2021-05-06 Richard Biener * timevar.def (TV_TREE_INSERT_PHI_NODES): Remove. (TV_TREE_SSA_REWRITE_BLOCKS): Likewise. (TV_TREE_INTO_SSA): New. * tree-into-ssa.c (insert_phi_nodes): Do not account separately. (rewrite_blocks): Likewise. (pass_data_build_ssa): Account to TV_TREE_INTO_SSA. --- gcc/timevar.def | 3 +-- gcc/tree-into-ssa.c | 11 +---------- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/gcc/timevar.def b/gcc/timevar.def index 63c0b3306de..16d1657436c 100644 --- a/gcc/timevar.def +++ b/gcc/timevar.def @@ -162,9 +162,8 @@ DEFTIMEVAR (TV_TREE_EARLY_VRP , "tree Early VRP") DEFTIMEVAR (TV_TREE_COPY_PROP , "tree copy propagation") DEFTIMEVAR (TV_FIND_REFERENCED_VARS , "tree find ref. vars") DEFTIMEVAR (TV_TREE_PTA , "tree PTA") -DEFTIMEVAR (TV_TREE_INSERT_PHI_NODES , "tree PHI insertion") -DEFTIMEVAR (TV_TREE_SSA_REWRITE_BLOCKS, "tree SSA rewrite") DEFTIMEVAR (TV_TREE_SSA_OTHER , "tree SSA other") +DEFTIMEVAR (TV_TREE_INTO_SSA , "tree SSA rewrite") DEFTIMEVAR (TV_TREE_SSA_INCREMENTAL , "tree SSA incremental") DEFTIMEVAR (TV_TREE_OPS , "tree operand scan") DEFTIMEVAR (TV_TREE_SSA_DOMINATOR_OPTS , "dominator optimization") diff --git a/gcc/tree-into-ssa.c b/gcc/tree-into-ssa.c index ef990604030..85adb1ad8c7 100644 --- a/gcc/tree-into-ssa.c +++ b/gcc/tree-into-ssa.c @@ -1071,8 +1071,6 @@ insert_phi_nodes (bitmap_head *dfs) unsigned i; var_info *info; - timevar_push (TV_TREE_INSERT_PHI_NODES); - /* When the gimplifier introduces SSA names it cannot easily avoid situations where abnormal edges added by CFG construction break the use-def dominance requirement. For this case rewrite SSA @@ -1141,8 +1139,6 @@ insert_phi_nodes (bitmap_head *dfs) insert_phi_nodes_for (info->var, idf, false); BITMAP_FREE (idf); } - - timevar_pop (TV_TREE_INSERT_PHI_NODES); } @@ -2282,9 +2278,6 @@ rewrite_update_dom_walker::after_dom_children (basic_block bb ATTRIBUTE_UNUSED) static void rewrite_blocks (basic_block entry, enum rewrite_mode what) { - /* Rewrite all the basic blocks in the program. */ - timevar_push (TV_TREE_SSA_REWRITE_BLOCKS); - block_defs_stack.create (10); /* Recursively walk the dominator tree rewriting each statement in @@ -2305,8 +2298,6 @@ rewrite_blocks (basic_block entry, enum rewrite_mode what) } block_defs_stack.release (); - - timevar_pop (TV_TREE_SSA_REWRITE_BLOCKS); } class mark_def_dom_walker : public dom_walker @@ -2402,7 +2393,7 @@ const pass_data pass_data_build_ssa = GIMPLE_PASS, /* type */ "ssa", /* name */ OPTGROUP_NONE, /* optinfo_flags */ - TV_TREE_SSA_OTHER, /* tv_id */ + TV_TREE_INTO_SSA, /* tv_id */ PROP_cfg, /* properties_required */ PROP_ssa, /* properties_provided */ 0, /* properties_destroyed */