From patchwork Wed Oct 2 11:49:26 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Biener X-Patchwork-Id: 1991985 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=TeNc4PaJ; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=II+f245K; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=TeNc4PaJ; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=II+f245K; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.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 ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4XJY5N6TLsz1xtn for ; Wed, 2 Oct 2024 21:50:00 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 077813861014 for ; Wed, 2 Oct 2024 11:49:59 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 9FBEB3858C60 for ; Wed, 2 Oct 2024 11:49:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 9FBEB3858C60 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 9FBEB3858C60 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727869769; cv=none; b=G+w0HPcuBPnXkzJd85LdmVnwX4lNIhervfzpxgyNx+xeeaqLUVaAd1rr+q/RvPQzuJWTd83TCv5KxZtuRiDMTs1mEP5dxwN7VmatUytP5HzjOa/JhP/TUDtjh80OWPEe9FC2gDZp/kDqK7LWeClKzri5rxAdqlJqUrz9LeEc/HI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1727869769; c=relaxed/simple; bh=0b1mzTxmCczB6MEPW2zMJCHkeSv7hgDl/2vktZvTto4=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:MIME-Version; b=AiIYKDV303XteP3BgQVPhb/xWIobEejty0Jzha44edj/S9gDKzNoKBKfmE4L+b6Fpw6TF/cavT+NYHeY+Vz+fkgW4SaBkg99ZdVFFcd4nyLmNwXjWni4bujhJFbME7vGba0deClzs0+3C+IYa7VX72/H7y0s3cDcSCDmM/lzcYI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from murzim.nue2.suse.org (unknown [10.168.4.243]) (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 smtp-out2.suse.de (Postfix) with ESMTPS id 64FF21FD56; Wed, 2 Oct 2024 11:49:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1727869766; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=7/nw70yZx3KU+7sRXSrZZFc9WqlkUMHtvkeQYifCeps=; b=TeNc4PaJeEM26xeJFTj2VkTstTcX86RWMyggUMQVY6cS9mpRf9nPgKJZ1ywKJ8lbC6NeXM nw/P0t0krDNLcT0h/0Iyz/H5dW9ojg+kGQn+7r7ZaA+gTpT8NMm2yqOT2JfxRW2V0yBCWz aXdp0sG5jt5vqb5eByUxWzAO0F667o0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1727869766; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=7/nw70yZx3KU+7sRXSrZZFc9WqlkUMHtvkeQYifCeps=; b=II+f245KlqoRIe8qT2KYZhRsxme/HE/PZYCmXB2M8g9EkLKQ1r0CbF4uf2SemCcdzujAda UWnrSlLNCT0mlZAA== Authentication-Results: smtp-out2.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1727869766; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=7/nw70yZx3KU+7sRXSrZZFc9WqlkUMHtvkeQYifCeps=; b=TeNc4PaJeEM26xeJFTj2VkTstTcX86RWMyggUMQVY6cS9mpRf9nPgKJZ1ywKJ8lbC6NeXM nw/P0t0krDNLcT0h/0Iyz/H5dW9ojg+kGQn+7r7ZaA+gTpT8NMm2yqOT2JfxRW2V0yBCWz aXdp0sG5jt5vqb5eByUxWzAO0F667o0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1727869766; h=from:from:reply-to:date:date:to:to:cc:cc:mime-version:mime-version: content-type:content-type; bh=7/nw70yZx3KU+7sRXSrZZFc9WqlkUMHtvkeQYifCeps=; b=II+f245KlqoRIe8qT2KYZhRsxme/HE/PZYCmXB2M8g9EkLKQ1r0CbF4uf2SemCcdzujAda UWnrSlLNCT0mlZAA== Date: Wed, 2 Oct 2024 13:49:26 +0200 (CEST) From: Richard Biener To: gcc-patches@gcc.gnu.org cc: jason@redhat.com Subject: [PATCH 1/3] Speedup iterative_hash_template_arg MIME-Version: 1.0 X-Spam-Score: -1.52 X-Spamd-Result: default: False [-1.52 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MISSING_MID(2.50)[]; NEURAL_HAM_LONG(-0.72)[-0.722]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCPT_COUNT_TWO(0.00)[2]; ARC_NA(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCVD_COUNT_ZERO(0.00)[0]; MISSING_XM_UA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; TO_DN_NONE(0.00)[]; MIME_TRACE(0.00)[0:+] X-Spam-Level: X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, MISSING_MID, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org Message-Id: <20241002114959.077813861014@sourceware.org> Using iterative_hash_object is expensive compared to using iterative_hash_hashval_t which is fit for integer sized values. The following reduces the number of perf cycles spent in iterative_hash_template_arg and iterative_hash combined by 20%. Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk? Thanks, Richard. gcc/cp/ * pt.cc (iterative_hash_template_arg): Avoid using iterative_hash_object. --- gcc/cp/pt.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc index 43468e5f62e..04f0a1d5fff 100644 --- a/gcc/cp/pt.cc +++ b/gcc/cp/pt.cc @@ -1751,7 +1751,7 @@ hashval_t iterative_hash_template_arg (tree arg, hashval_t val) { if (arg == NULL_TREE) - return iterative_hash_object (arg, val); + return iterative_hash_hashval_t (0, val); if (!TYPE_P (arg)) /* Strip nop-like things, but not the same as STRIP_NOPS. */ @@ -1762,7 +1762,7 @@ iterative_hash_template_arg (tree arg, hashval_t val) enum tree_code code = TREE_CODE (arg); - val = iterative_hash_object (code, val); + val = iterative_hash_hashval_t (code, val); switch (code) { @@ -1777,7 +1777,7 @@ iterative_hash_template_arg (tree arg, hashval_t val) return val; case IDENTIFIER_NODE: - return iterative_hash_object (IDENTIFIER_HASH_VALUE (arg), val); + return iterative_hash_hashval_t (IDENTIFIER_HASH_VALUE (arg), val); case TREE_VEC: for (tree elt : tree_vec_range (arg))