https://gcc.gnu.org/g:9fa534f0831892393885e64596a0d6ca8c4078b6

commit r16-696-g9fa534f0831892393885e64596a0d6ca8c4078b6
Author: Martin Jambor <mjam...@suse.cz>
Date:   Fri May 16 17:13:51 2025 +0200

    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  <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.
            * 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 <mji...@suse.cz>

Diff:
---
 gcc/cgraph.cc       | 2 +-
 gcc/cgraph.h        | 2 +-
 gcc/cgraphclones.cc | 4 ++--
 gcc/ipa-cp.cc       | 2 +-
 gcc/ipa-sra.cc      | 2 +-
 gcc/symtab.cc       | 4 ++--
 6 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc
index 1a2ec38374ab..ac0f2519361b 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 f4ee29e998c3..8dbe36eac09d 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 b45ac4977331..c160e8b6985b 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);
 
diff --git a/gcc/ipa-cp.cc b/gcc/ipa-cp.cc
index b41148c74de3..f06ac46dfffb 100644
--- a/gcc/ipa-cp.cc
+++ b/gcc/ipa-cp.cc
@@ -288,7 +288,7 @@ ipcp_lattice<valtype>::print (FILE * f, bool dump_sources, 
bool dump_benefits)
          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 1331ba49b507..88bfae9502c7 100644
--- a/gcc/ipa-sra.cc
+++ b/gcc/ipa-sra.cc
@@ -4644,7 +4644,7 @@ ipa_sra_summarize_function (cgraph_node *node)
 {
   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 fe9c031247f9..fc1155f46964 100644
--- a/gcc/symtab.cc
+++ b/gcc/symtab.cc
@@ -989,10 +989,10 @@ symtab_node::dump_base (FILE *f)
             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");

Reply via email to