From patchwork Fri Oct 8 10:23:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Martin_Li=C5=A1ka?= X-Patchwork-Id: 45993 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 333773857C62 for ; Fri, 8 Oct 2021 10:23:32 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by sourceware.org (Postfix) with ESMTPS id 7AFDB3858403 for ; Fri, 8 Oct 2021 10:23:16 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7AFDB3858403 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B4B3021E54; Fri, 8 Oct 2021 10:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1633688595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dXgtpveQ1LRTZBkFJDL66dmySpgvkfxsrxzjBi5G+k4=; b=CXh7mXuY2bcD0Ij+EG/tbr/uMyq0bL1TyxLnKvFie4R3Gev8XchsnKm+kYXg/xgKD+ilga CmBSecgHB24bM5dScauZFGB1bCWznw3ETnZrFnn5pTamvhgnfQMpG6fACVECnq3DfEVG3L +PlhJb5yP3bKaqY2R81LdV74m6f5/gQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1633688595; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=dXgtpveQ1LRTZBkFJDL66dmySpgvkfxsrxzjBi5G+k4=; b=cxkWs/rPqQHOc4seJY9bWrN6zzAlE0DfNFAgV0WANapcbvYgdddcDPEsNENjCgd9oHaE9d kTGLQDcB/yVCH/Dg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id A37CB13EB3; Fri, 8 Oct 2021 10:23:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id VWJYJxMcYGFPIQAAMHmgww (envelope-from ); Fri, 08 Oct 2021 10:23:15 +0000 Message-ID: Date: Fri, 8 Oct 2021 12:23:11 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 From: =?utf-8?q?Martin_Li=C5=A1ka?= Subject: [PATCH] options: use cl_optimization_hash. To: gcc-patches@gcc.gnu.org Content-Language: en-US X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , Cc: Jan Hubicka Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hello. Right now, we use legacy hashing function in cl_option_hasher and I also need the change for the future fix of PR102585. Patch can bootstrap on x86_64-linux-gnu and survives regression tests. Ready to be installed? Thanks, Martin gcc/ChangeLog: * tree.c (cl_option_hasher::hash): Use cl_optimization_hash and remove legacy hashing code. --- gcc/tree.c | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/gcc/tree.c b/gcc/tree.c index 561b9cd56bd..7bfd64160f4 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -11473,30 +11473,13 @@ hashval_t cl_option_hasher::hash (tree x) { const_tree const t = x; - const char *p; - size_t i; - size_t len = 0; - hashval_t hash = 0; if (TREE_CODE (t) == OPTIMIZATION_NODE) - { - p = (const char *)TREE_OPTIMIZATION (t); - len = sizeof (struct cl_optimization); - } - + return cl_optimization_hash (TREE_OPTIMIZATION (t)); else if (TREE_CODE (t) == TARGET_OPTION_NODE) return cl_target_option_hash (TREE_TARGET_OPTION (t)); - else gcc_unreachable (); - - /* assume most opt flags are just 0/1, some are 2-3, and a few might be - something else. */ - for (i = 0; i < len; i++) - if (p[i]) - hash = (hash << 4) ^ ((i << 2) | p[i]); - - return hash; } /* Return nonzero if the value represented by *X (an OPTIMIZATION or