From: Michal Jires Date: Thu, 24 Oct 2024 00:21:00 +0000 (+0200) Subject: Node clones share order. X-Git-Tag: basepoints/gcc-16~3208 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0895aef01c64c317b489811dbe4ac55f9c13aab3;p=thirdparty%2Fgcc.git Node clones share order. 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. --- diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 9b4cb6383afc..099fae654da1 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) @@ -2819,7 +2819,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 33cab4583348..9f05477cb825 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;