Hi,

starting with 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).

Bootstrapped and tested on x86_64-linux. OK for master and gcc 15?

Thanks,

Martin


gcc/ChangeLog:

2025-04-23  Martin Jambor  <mjam...@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.
---
 gcc/cgraph.cc       | 2 +-
 gcc/cgraph.h        | 2 +-
 gcc/cgraphclones.cc | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 6ae6a97f6f5..48646de6aa3 100644
--- a/gcc/cgraph.cc
+++ b/gcc/cgraph.cc
@@ -1879,7 +1879,7 @@ cgraph_node::remove (void)
   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 abde770ba2b..45119e3dce9 100644
--- a/gcc/cgraph.h
+++ b/gcc/cgraph.h
@@ -493,7 +493,7 @@ public:
   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 bf5bc41cde9..3c9c642bdec 100644
--- a/gcc/cgraphclones.cc
+++ b/gcc/cgraphclones.cc
@@ -324,11 +324,11 @@ dump_callgraph_transformation (const cgraph_node 
*original,
     {
       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);
 
-- 
2.49.0

Reply via email to