]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Node clones share order.
authorMichal Jires <mjires@suse.cz>
Thu, 24 Oct 2024 00:21:00 +0000 (02:21 +0200)
committerMichal Jires <mjires@suse.cz>
Wed, 18 Dec 2024 17:19:09 +0000 (18:19 +0100)
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
gcc/cgraphclones.cc

index 9b4cb6383afc2eab80007668cd509461dd04c995..099fae654da137208625326b75837ddfc122ed7b 100644 (file)
@@ -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.  */
index 33cab4583348daa9a80c659af2ea7f5b3f3d562a..9f05477cb8254124833035305671c94d014d901f 100644 (file)
@@ -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;