https://gcc.gnu.org/g:3facb0e2b5a1a407ad71327ed56cd81109a37b1b
commit r16-4746-g3facb0e2b5a1a407ad71327ed56cd81109a37b1b Author: Michal Jires <[email protected]> Date: Mon Aug 25 17:26:47 2025 +0200 lto: Keep lto file data We use lto_file_data in 1to1 partitioning, so we need to not zero it out. Nothing depends on lto_file_data being NULL. gcc/ChangeLog: * cgraph.cc (cgraph_node::release_body): Keep lto_file_data. (cgraph_node::remove): likewise. * lto-section-in.cc (lto_free_function_in_decl_state_for_node): likewise. * varpool.cc (varpool_node::remove): likewise. gcc/lto/ChangeLog: * lto-symtab.cc (lto_symtab_merge_symbols_1): likewise. Diff: --- gcc/cgraph.cc | 11 ++--------- gcc/lto-section-in.cc | 1 - gcc/lto/lto-symtab.cc | 6 +----- gcc/varpool.cc | 6 +----- 4 files changed, 4 insertions(+), 20 deletions(-) diff --git a/gcc/cgraph.cc b/gcc/cgraph.cc index d1b2e2a162c0..ab09376a1a0d 100644 --- a/gcc/cgraph.cc +++ b/gcc/cgraph.cc @@ -2220,11 +2220,7 @@ cgraph_node::release_body (bool keep_arguments) if (!used_as_abstract_origin && DECL_INITIAL (decl)) DECL_INITIAL (decl) = error_mark_node; release_function_body (decl); - if (lto_file_data) - { - lto_free_function_in_decl_state_for_node (this); - lto_file_data = NULL; - } + lto_free_function_in_decl_state_for_node (this); if (flag_checking && clones) { /* It is invalid to release body before materializing clones except @@ -2336,10 +2332,7 @@ cgraph_node::remove (void) release_body (); } else - { - lto_free_function_in_decl_state_for_node (this); - lto_file_data = NULL; - } + lto_free_function_in_decl_state_for_node (this); decl = NULL; if (call_site_hash) diff --git a/gcc/lto-section-in.cc b/gcc/lto-section-in.cc index 1dd9520137a1..bf8621925dc8 100644 --- a/gcc/lto-section-in.cc +++ b/gcc/lto-section-in.cc @@ -448,7 +448,6 @@ lto_free_function_in_decl_state_for_node (symtab_node *node) lto_free_function_in_decl_state (*slot); node->lto_file_data->function_decl_states->clear_slot (slot); } - node->lto_file_data = NULL; } diff --git a/gcc/lto/lto-symtab.cc b/gcc/lto/lto-symtab.cc index 66674a4415f8..8d7fc6805e92 100644 --- a/gcc/lto/lto-symtab.cc +++ b/gcc/lto/lto-symtab.cc @@ -953,11 +953,7 @@ lto_symtab_merge_symbols_1 (symtab_node *prevailing) else { DECL_INITIAL (e->decl) = error_mark_node; - if (e->lto_file_data) - { - lto_free_function_in_decl_state_for_node (e); - e->lto_file_data = NULL; - } + lto_free_function_in_decl_state_for_node (e); symtab->call_varpool_removal_hooks (dyn_cast<varpool_node *> (e)); } e->remove_all_references (); diff --git a/gcc/varpool.cc b/gcc/varpool.cc index 976e0fa60aa0..8dc5f9862945 100644 --- a/gcc/varpool.cc +++ b/gcc/varpool.cc @@ -172,11 +172,7 @@ void varpool_node::remove (void) { symtab->call_varpool_removal_hooks (this); - if (lto_file_data) - { - lto_free_function_in_decl_state_for_node (this); - lto_file_data = NULL; - } + lto_free_function_in_decl_state_for_node (this); /* When streaming we can have multiple nodes associated with decl. */ if (symtab->state == LTO_STREAMING)
