From patchwork Thu Aug 6 08:21:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1341518 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=8.43.85.97; helo=sourceware.org; envelope-from=gcc-patches-bounces@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.de Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (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 4BMhK72gsDz9sTC for ; Thu, 6 Aug 2020 18:21:14 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 8EFB43857C41; Thu, 6 Aug 2020 08:21:10 +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 1C0503858D37 for ; Thu, 6 Aug 2020 08:21:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 1C0503858D37 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 15E4BAC22 for ; Thu, 6 Aug 2020 08:21:24 +0000 (UTC) Date: Thu, 6 Aug 2020 10:21:06 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org Subject: [PATCH] Remove std::map use from graphite Message-ID: User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 X-Spam-Status: No, score=-10.1 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 replaces the use of std::map with hash_map for mapping ISL ids to SSA names. Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. 2020-08-06 Richard Biener * graphite-isl-ast-to-gimple.c (ivs_params): Use hash_map instead of std::map. (ivs_params_clear): Adjust. (gcc_expression_from_isl_ast_expr_id): Likewise. (graphite_create_new_loop): Likewise. (add_parameters_to_ivs_params): Likewise. --- gcc/graphite-isl-ast-to-gimple.c | 30 +++++++++++------------------- 1 file changed, 11 insertions(+), 19 deletions(-) diff --git a/gcc/graphite-isl-ast-to-gimple.c b/gcc/graphite-isl-ast-to-gimple.c index 81f7b48887c..5fa70ff2d4e 100644 --- a/gcc/graphite-isl-ast-to-gimple.c +++ b/gcc/graphite-isl-ast-to-gimple.c @@ -24,7 +24,6 @@ along with GCC; see the file COPYING3. If not see #ifdef HAVE_isl -#define INCLUDE_MAP #include "system.h" #include "coretypes.h" #include "backend.h" @@ -69,18 +68,14 @@ struct ast_build_info /* IVS_PARAMS maps isl's scattering and parameter identifiers to corresponding trees. */ -typedef std::map ivs_params; +typedef hash_map ivs_params; /* Free all memory allocated for isl's identifiers. */ static void ivs_params_clear (ivs_params &ip) { - std::map::iterator it; - for (it = ip.begin (); - it != ip.end (); it++) - { - isl_id_free (it->first); - } + for (auto it = ip.begin (); it != ip.end (); ++it) + isl_id_free ((*it).first); } /* Set the "separate" option for the schedule node. */ @@ -256,13 +251,11 @@ gcc_expression_from_isl_ast_expr_id (tree type, { gcc_assert (isl_ast_expr_get_type (expr_id) == isl_ast_expr_id); isl_id *tmp_isl_id = isl_ast_expr_get_id (expr_id); - std::map::iterator res; - res = ip.find (tmp_isl_id); + tree *tp = ip.get (tmp_isl_id); isl_id_free (tmp_isl_id); - gcc_assert (res != ip.end () && - "Could not map isl_id to tree expression"); + gcc_assert (tp && "Could not map isl_id to tree expression"); isl_ast_expr_free (expr_id); - tree t = res->second; + tree t = *tp; if (useless_type_conversion_p (type, TREE_TYPE (t))) return t; if (POINTER_TYPE_P (TREE_TYPE (t)) @@ -596,11 +589,9 @@ graphite_create_new_loop (edge entry_edge, __isl_keep isl_ast_node *node_for, isl_ast_expr *for_iterator = isl_ast_node_for_get_iterator (node_for); isl_id *id = isl_ast_expr_get_id (for_iterator); - std::map::iterator res; - res = ip.find (id); - if (ip.count (id)) - isl_id_free (res->first); - ip[id] = iv; + bool existed_p = ip.put (id, iv); + if (existed_p) + isl_id_free (id); isl_ast_expr_free (for_iterator); return loop; } @@ -1347,7 +1338,8 @@ add_parameters_to_ivs_params (scop_p scop, ivs_params &ip) { isl_id *tmp_id = isl_set_get_dim_id (scop->param_context, isl_dim_param, i); - ip[tmp_id] = param; + bool existed_p = ip.put (tmp_id, param); + gcc_assert (!existed_p); } }