From patchwork Wed Nov 6 13:02:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michal Jires X-Patchwork-Id: 2007536 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.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=2z+bDcIK; dkim=pass header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=L2B75RqT; dkim=pass (1024-bit key) header.d=suse.cz header.i=@suse.cz header.a=rsa-sha256 header.s=susede2_rsa header.b=2z+bDcIK; dkim=neutral header.d=suse.cz header.i=@suse.cz header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=L2B75RqT; 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 4Xk53Y625mz1xxf for ; Thu, 7 Nov 2024 00:03:05 +1100 (AEDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 0ED593858C52 for ; Wed, 6 Nov 2024 13:03:04 +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.223.130]) by sourceware.org (Postfix) with ESMTPS id A46C33858420 for ; Wed, 6 Nov 2024 13:02:03 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A46C33858420 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.cz ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A46C33858420 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730898134; cv=none; b=vy2p4pHw13A1S48dV23v6hhSW5aH97bl0I8r894QNwJ6LD2BiQdjN/BLA8LDVBaDFg25e3TZ2qEb3w2ND4GUSVMciO+C4Zm5gB0azWbWlrgTk5fJG4qVGMW1cYZZNzR/IXyCshpK1D6Wqnv5lH2iSm/hcUsPE7/cLE2L5HD9fSs= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1730898134; c=relaxed/simple; bh=xVrzyCdUf0Zz6fzl7CTN7zH144B/efdF6G6XzqaicWQ=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:Date: From:To:Subject:Message-ID:MIME-Version; b=kBEmQe4qi73NLKigR8sCdDt9gHraUvlsxKfQGUDg9t7UZTam82jxhEhmAd8X8KhWoPCF/Q3JoM98ow7G9Ep40DRtmOK9hbnoRSL9koO1tNx9qazqXpjKdkvSDk9ei8UorMFLh56abHiCHLlzTyHkkZphYhnQ0SKAsTrbu1pfv+U= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from imap1.dmz-prg2.suse.org (unknown [10.150.64.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 smtp-out1.suse.de (Postfix) with ESMTPS id 9974321B48; Wed, 6 Nov 2024 13:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1730898122; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PL8mu73U726x9Arx42fU2+Nep/XcxmAJBUMWtDN4p6s=; b=2z+bDcIKfkruVzEgm9d5j46FTTqowQ7uvCZILUX0ZULrL5cB0udDlldwFbyNjLRxK+sDSb rQAlTOIkFYTVTE8s6vIvwZrz7KC9I5t1OPtYhOQsek7Hk2P7QXsn67Nt2zCJC/Jtw7raFJ RLDZUU0LJOtHZmlhmkdGtDfTCbCZVnE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1730898122; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PL8mu73U726x9Arx42fU2+Nep/XcxmAJBUMWtDN4p6s=; b=L2B75RqTI1N6IFTv774W4feEDHXUiHb8Hl8y3zPYK6puNjcwrFIqarvH6c8rPeJYKF6Fhl yZ5VXdRo9rSi+3Dg== Authentication-Results: smtp-out1.suse.de; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1730898122; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PL8mu73U726x9Arx42fU2+Nep/XcxmAJBUMWtDN4p6s=; b=2z+bDcIKfkruVzEgm9d5j46FTTqowQ7uvCZILUX0ZULrL5cB0udDlldwFbyNjLRxK+sDSb rQAlTOIkFYTVTE8s6vIvwZrz7KC9I5t1OPtYhOQsek7Hk2P7QXsn67Nt2zCJC/Jtw7raFJ RLDZUU0LJOtHZmlhmkdGtDfTCbCZVnE= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1730898122; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PL8mu73U726x9Arx42fU2+Nep/XcxmAJBUMWtDN4p6s=; b=L2B75RqTI1N6IFTv774W4feEDHXUiHb8Hl8y3zPYK6puNjcwrFIqarvH6c8rPeJYKF6Fhl yZ5VXdRo9rSi+3Dg== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (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 imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id 7668513736; Wed, 6 Nov 2024 13:02:02 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id Qza9G8poK2fJGgAAD6G6ig (envelope-from ); Wed, 06 Nov 2024 13:02:02 +0000 Date: Wed, 6 Nov 2024 14:02:01 +0100 From: Michal Jires To: gcc-patches@gcc.gnu.org Cc: hubicka@ucw.cz Subject: [PATCH 2/3] Node clones share order. Message-ID: References: <62832e7f7915de005159c5ae60872e087ef7ae05.1730885483.git.mjires@suse.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <62832e7f7915de005159c5ae60872e087ef7ae05.1730885483.git.mjires@suse.cz> X-Spamd-Result: default: False [-3.30 / 50.00]; BAYES_HAM(-3.00)[99.99%]; MID_CONTAINS_FROM(1.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.20)[-1.000]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; FUZZY_BLOCKED(0.00)[rspamd.com]; RCPT_COUNT_TWO(0.00)[2]; DKIM_SIGNED(0.00)[suse.cz:s=susede2_rsa,suse.cz:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; MISSING_XM_UA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_NONE(0.00)[]; MIME_TRACE(0.00)[0:+] 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 Symbol order corresponds to the order in source code. For clones their order is currently arbitrarily chosen as max order++ But it would be more consistent with original purpose to choose clones order to be shared with the original node order. This stabilizes clone order for Incremental LTO. Order is thus no longer unique, but this property is not used outside of previous patch, where we can use uid. If total order would be needed, sorting by order and then uid suffices. gcc/ChangeLog: * cgraph.h (symbol_table::register_symbol): Order can be already set. * cgraphclones.cc (cgraph_node::create_clone): Reuse order for clones. --- gcc/cgraph.h | 5 +++-- gcc/cgraphclones.cc | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gcc/cgraph.h b/gcc/cgraph.h index a8c3224802c..508788b062b 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -121,7 +121,7 @@ public: used_from_other_partition (false), in_other_partition (false), address_taken (false), in_init_priority_hash (false), need_lto_streaming (false), offloadable (false), ifunc_resolver (false), - order (false), next_sharing_asm_name (NULL), + order (-1), next_sharing_asm_name (NULL), previous_sharing_asm_name (NULL), same_comdat_group (NULL), ref_list (), alias_target (NULL), lto_file_data (NULL), aux (NULL), x_comdat_group (NULL_TREE), x_section (NULL) @@ -2815,7 +2815,8 @@ symbol_table::register_symbol (symtab_node *node) nodes->previous = node; nodes = node; - node->order = order++; + if (node->order == -1) + node->order = order++; } /* Register a top-level asm statement ASM_STR. */ diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc index 4fff6873a36..fc0f9046d99 100644 --- a/gcc/cgraphclones.cc +++ b/gcc/cgraphclones.cc @@ -401,6 +401,7 @@ cgraph_node::create_clone (tree new_decl, profile_count prof_count, count = count.combine_with_ipa_count (count.ipa () - prof_count.ipa ()); } new_node->decl = new_decl; + new_node->order = order; new_node->register_symbol (); new_node->lto_file_data = lto_file_data; new_node->analyzed = analyzed;