From patchwork Thu Oct 10 19:25:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 1174776 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-510690-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=ucw.cz Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="Mff+BDc0"; dkim-atps=neutral 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 46q1Jc1ZwNz9sDB for ; Fri, 11 Oct 2019 06:25:34 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=oJQsyMZW5vhVUcGdnbUN+kBDYei066EOhVkrtN4cqEkw8kxtkNAVJ DrH+APl96Mgp9n54liap8uW3SMnVPZqUH/ZbX0Sd5AaWGo/v4o/ESNEoXz5mmAKv oXdtBmwHyhC5VIoJURwLmiWMaWF0MC8oToptGEaHCn82PB96Y1XvTA= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=DdHCeH8nN2p9kaaiY45N86+mcJI=; b=Mff+BDc0iuW2jud/rNTR efjg89MmlGdbNYY0CSqSA/WfDuVyBAiBrH0DDtgX874MKEMSYTkNqBITSqQ48fFl U761Wbsifq13kM5FNKcEy05LESfu8hnZDhEAtcjNlxr2MrK7KFaVjQcHygh7vaG/ rvhLqsjCG9HbXoWsaK+xoAo= Received: (qmail 6297 invoked by alias); 10 Oct 2019 19:25:27 -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 6289 invoked by uid 89); 10 Oct 2019 19:25:27 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-12.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3 autolearn=ham version=3.3.1 spammy= X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 10 Oct 2019 19:25:25 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 0BED9282799; Thu, 10 Oct 2019 21:25:23 +0200 (CEST) Date: Thu, 10 Oct 2019 21:25:23 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org Subject: Remove splay tree form ipa-reference.c Message-ID: <20191010192523.jg3tkhvqvkoy6slx@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: NeoMutt/20170113 (1.7.2) Hi, ipa-reference uses splay tree to map DECL_UIDs to trees. On other places we use hash-maps which are more sutiable. Bootstrapped/regtested x86_64-linux, comitted. Honza * ipa-reference.c: Do not include splay-tree.h (reference_vars_to_consider): Turn to hash map. (get_static_name, ipa_init, analyze_function, propagate, stream_out_bitmap, ipa_reference_write_optimization_summary, ipa_reference_write_optimization_summary): Update. Index: ipa-reference.c =================================================================== --- ipa-reference.c (revision 276849) +++ ipa-reference.c (working copy) @@ -46,7 +46,6 @@ along with GCC; see the file COPYING3. #include "cgraph.h" #include "data-streamer.h" #include "calls.h" -#include "splay-tree.h" #include "ipa-utils.h" #include "ipa-reference.h" #include "symbol-summary.h" @@ -92,9 +91,11 @@ struct ipa_reference_vars_info_d typedef struct ipa_reference_vars_info_d *ipa_reference_vars_info_t; -/* This splay tree contains all of the static variables that are +/* This map contains all of the static variables that are being considered by the compilation level alias analysis. */ -static splay_tree reference_vars_to_consider; +typedef hash_map, tree> + reference_vars_to_consider_t; +static reference_vars_to_consider_t *reference_vars_to_consider; /* Set of all interesting module statics. A bit is set for every module static we are considering. This is added to the local info when asm @@ -272,9 +273,7 @@ is_proper_for_analysis (tree t) static const char * get_static_name (int index) { - splay_tree_node stn = - splay_tree_lookup (reference_vars_to_consider, index); - return fndecl_name ((tree)(stn->value)); + return fndecl_name (*reference_vars_to_consider->get (index)); } /* Dump a set of static vars to FILE. */ @@ -416,7 +415,7 @@ ipa_init (void) ipa_init_p = true; if (dump_file) - reference_vars_to_consider = splay_tree_new (splay_tree_compare_ints, 0, 0); + reference_vars_to_consider = new reference_vars_to_consider_t(251); bitmap_obstack_initialize (&local_info_obstack); bitmap_obstack_initialize (&optimization_summary_obstack); @@ -476,9 +475,8 @@ analyze_function (struct cgraph_node *fn && bitmap_set_bit (all_module_statics, ipa_reference_var_uid (var))) { if (dump_file) - splay_tree_insert (reference_vars_to_consider, - ipa_reference_var_uid (var), - (splay_tree_value)var); + reference_vars_to_consider->put (ipa_reference_var_uid (var), + var); } switch (ref->use) { @@ -898,7 +896,7 @@ propagate (void) } if (dump_file) - splay_tree_delete (reference_vars_to_consider); + delete reference_vars_to_consider; reference_vars_to_consider = NULL; return remove_p ? TODO_remove_functions : 0; } @@ -968,8 +966,7 @@ stream_out_bitmap (struct lto_simple_out return; EXECUTE_IF_AND_IN_BITMAP (bits, ltrans_statics, 0, index, bi) { - tree decl = (tree)splay_tree_lookup (reference_vars_to_consider, - index)->value; + tree decl = *reference_vars_to_consider->get (index); lto_output_var_decl_index (ob->decl_state, ob->main_stream, decl); } } @@ -987,7 +984,7 @@ ipa_reference_write_optimization_summary auto_bitmap ltrans_statics; int i; - reference_vars_to_consider = splay_tree_new (splay_tree_compare_ints, 0, 0); + reference_vars_to_consider = new reference_vars_to_consider_t (251); /* See what variables we are interested in. */ for (i = 0; i < lto_symtab_encoder_size (encoder); i++) @@ -1001,9 +998,8 @@ ipa_reference_write_optimization_summary { tree decl = vnode->decl; bitmap_set_bit (ltrans_statics, ipa_reference_var_uid (decl)); - splay_tree_insert (reference_vars_to_consider, - ipa_reference_var_uid (decl), - (splay_tree_value)decl); + reference_vars_to_consider->put + (ipa_reference_var_uid (decl), decl); ltrans_statics_bitcount ++; } } @@ -1045,7 +1041,7 @@ ipa_reference_write_optimization_summary } } lto_destroy_simple_output_block (ob); - splay_tree_delete (reference_vars_to_consider); + delete reference_vars_to_consider; } /* Deserialize the ipa info for lto. */