diff options
author | Michal Jires <mjires@suse.cz> | 2025-01-16 14:42:59 +0100 |
---|---|---|
committer | Michal Jires <mjires@suse.cz> | 2025-01-18 20:40:47 +0100 |
commit | 557d1a44ece3b9cf0084a4ebcc2e50875d788393 (patch) | |
tree | a051b523a60d84d7d35c7d02221b62c85f76499f /gcc/cgraph.h | |
parent | d309844d6fe02e695eb82cbd30fd135e836f24eb (diff) | |
download | gcc-557d1a44ece3b9cf0084a4ebcc2e50875d788393.zip gcc-557d1a44ece3b9cf0084a4ebcc2e50875d788393.tar.gz gcc-557d1a44ece3b9cf0084a4ebcc2e50875d788393.tar.bz2 |
Fix uniqueness of symtab_node::get_dump_name.
symtab_node::get_dump_name uses node order to identify nodes.
Order is no longer unique because of Incremental LTO patches.
This patch moves uid from cgraph_node node to symtab_node,
so get_dump_name can use uid instead and get back unique dump names.
In inlining passes, uid is replaced with more appropriate (more compact
for indexing) summary id.
Bootstrapped/regtested on x86_64-linux.
Ok for trunk?
gcc/ChangeLog:
* cgraph.cc (symbol_table::create_empty):
Move uid to symtab_node.
(test_symbol_table_test): Change expected dump id.
* cgraph.h (struct cgraph_node):
Move uid to symtab_node.
(symbol_table::register_symbol): Likewise.
* dumpfile.cc (test_capture_of_dump_calls):
Change expected dump id.
* ipa-inline.cc (update_caller_keys):
Use summary id instead of uid.
(update_callee_keys): Likewise.
* symtab.cc (symtab_node::get_dump_name):
Use uid instead of order.
gcc/testsuite/ChangeLog:
* gcc.dg/live-patching-1.c: Change expected dump id.
* gcc.dg/live-patching-4.c: Likewise.
Diffstat (limited to 'gcc/cgraph.h')
-rw-r--r-- | gcc/cgraph.h | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 7856d53..065fcc7 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -124,7 +124,7 @@ public: 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) + x_comdat_group (NULL_TREE), x_section (NULL), m_uid (-1) {} /* Return name. */ @@ -492,6 +492,12 @@ public: /* Perform internal consistency checks, if they are enabled. */ static inline void checking_verify_symtab_nodes (void); + /* Get unique identifier of the node. */ + inline int get_uid () + { + return m_uid; + } + /* Type of the symbol. */ ENUM_BITFIELD (symtab_type) type : 8; @@ -668,6 +674,9 @@ protected: void *data, bool include_overwrite); private: + /* Unique id of the node. */ + int m_uid; + /* Workers for set_section. */ static bool set_section_from_string (symtab_node *n, void *s); static bool set_section_from_node (symtab_node *n, void *o); @@ -882,7 +891,7 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node friend class symbol_table; /* Constructor. */ - explicit cgraph_node (int uid) + explicit cgraph_node () : symtab_node (SYMTAB_FUNCTION), callees (NULL), callers (NULL), indirect_calls (NULL), next_sibling_clone (NULL), prev_sibling_clone (NULL), clones (NULL), @@ -903,7 +912,7 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node redefined_extern_inline (false), tm_may_enter_irr (false), ipcp_clone (false), gc_candidate (false), called_by_ifunc_resolver (false), has_omp_variant_constructs (false), - m_uid (uid), m_summary_id (-1) + m_summary_id (-1) {} /* Remove the node from cgraph and all inline clones inlined into it. @@ -1304,12 +1313,6 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node dump_cgraph (stderr); } - /* Get unique identifier of the node. */ - inline int get_uid () - { - return m_uid; - } - /* Get summary id of the node. */ inline int get_summary_id () { @@ -1503,8 +1506,6 @@ struct GTY((tag ("SYMTAB_FUNCTION"))) cgraph_node : public symtab_node unsigned has_omp_variant_constructs : 1; private: - /* Unique id of the node. */ - int m_uid; /* Summary id that is recycled. */ int m_summary_id; @@ -2815,6 +2816,8 @@ symbol_table::register_symbol (symtab_node *node) nodes->previous = node; nodes = node; + nodes->m_uid = cgraph_max_uid++; + if (node->order == -1) node->order = order++; } |