ipa: Dump cgraph_node UID instead of order into ipa-clones dump file

Since starting from GCC 15 the order is not unique for any
symtab_nodes but m_uid is, I believe we ought to dump the latter in
the ipa-clones dump, if only so that people can reliably match entries
about new clones to those about removed nodes (if any).

This patch also contains a fixes to a few other places where we have
so far dumped order to our ordinary dumps and which have been
identified by Michal Jires.

gcc/ChangeLog:

2025-05-16  Martin Jambor  <mjambor@suse.cz>

	* cgraph.h (symtab_node): Make member function get_uid const.
	* cgraphclones.cc (dump_callgraph_transformation): Dump m_uid of the
	call graph nodes instead of order.
	* cgraph.cc (cgraph_node::remove): Likewise.
	* ipa-cp.cc (ipcp_lattice<valtype>::print): Likewise.
	* ipa-sra.cc (ipa_sra_summarize_function): Likewise.
	* symtab.cc (symtab_node::dump_base): Likewise.

Co-Authored-By: Michal Jires <mjires@suse.cz>
(cherry picked from commit 9fa534f0831892393885e64596a0d6ca8c4078b6)
diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 6ae6a97..48646de 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1879,7 +1879,7 @@
   clone_info *info, saved_info;
   if (symtab->ipa_clones_dump_file && symtab->cloned_nodes.contains (this))
     fprintf (symtab->ipa_clones_dump_file,
-	     "Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), order,
+	     "Callgraph removal;%s;%d;%s;%d;%d\n", asm_name (), get_uid (),
 	     DECL_SOURCE_FILE (decl), DECL_SOURCE_LINE (decl),
 	     DECL_SOURCE_COLUMN (decl));
 
diff --git a/gcc/cgraph.h b/gcc/cgraph.h
index abde770..45119e3 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -493,7 +493,7 @@
   static inline void checking_verify_symtab_nodes (void);
 
   /* Get unique identifier of the node.  */
-  inline int get_uid ()
+  inline int get_uid () const
   {
     return m_uid;
   }
diff --git a/gcc/cgraphclones.cc b/gcc/cgraphclones.cc
index bf5bc41..3c9c642 100644
--- a/gcc/cgraphclones.cc
+++ b/gcc/cgraphclones.cc
@@ -324,11 +324,11 @@
     {
       fprintf (symtab->ipa_clones_dump_file,
 	       "Callgraph clone;%s;%d;%s;%d;%d;%s;%d;%s;%d;%d;%s\n",
-	       original->asm_name (), original->order,
+	       original->asm_name (), original->get_uid (),
 	       DECL_SOURCE_FILE (original->decl),
 	       DECL_SOURCE_LINE (original->decl),
 	       DECL_SOURCE_COLUMN (original->decl), clone->asm_name (),
-	       clone->order, DECL_SOURCE_FILE (clone->decl),
+	       clone->get_uid (), DECL_SOURCE_FILE (clone->decl),
 	       DECL_SOURCE_LINE (clone->decl), DECL_SOURCE_COLUMN (clone->decl),
 	       suffix);
 
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index a8ff3c8..7ce9ba7 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -292,7 +292,7 @@
 	  else
 	    fprintf (f, " [scc: %i, from:", val->scc_no);
 	  for (s = val->sources; s; s = s->next)
-	    fprintf (f, " %i(%f)", s->cs->caller->order,
+	    fprintf (f, " %i(%f)", s->cs->caller->get_uid (),
 		     s->cs->sreal_frequency ().to_double ());
 	  fprintf (f, "]");
 	}
diff --git a/gcc/ipa-sra.cc b/gcc/ipa-sra.cc
index 1331ba49..88bfae9 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -4644,7 +4644,7 @@
 {
   if (dump_file)
     fprintf (dump_file, "Creating summary for %s/%i:\n", node->name (),
-	     node->order);
+	     node->get_uid ());
   gcc_obstack_init (&gensum_obstack);
   loaded_decls = new hash_set<tree>;
 
diff --git a/gcc/symtab.cc b/gcc/symtab.cc
index fe9c031..fc1155f 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -989,10 +989,10 @@
 	     same_comdat_group->dump_asm_name ());
   if (next_sharing_asm_name)
     fprintf (f, "  next sharing asm name: %i\n",
-	     next_sharing_asm_name->order);
+	     next_sharing_asm_name->get_uid ());
   if (previous_sharing_asm_name)
     fprintf (f, "  previous sharing asm name: %i\n",
-	     previous_sharing_asm_name->order);
+	     previous_sharing_asm_name->get_uid ());
 
   if (address_taken)
     fprintf (f, "  Address is taken.\n");