From: Michal Jires Date: Mon, 25 Aug 2025 15:26:47 +0000 (+0200) Subject: lto: Keep lto file data X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3facb0e2b5a1a407ad71327ed56cd81109a37b1b;p=thirdparty%2Fgcc.git 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 --git a/gcc/cgraph.cc b/gcc/cgraph.cc index d1b2e2a162c..ab09376a1a0 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 1dd9520137a..bf8621925dc 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 66674a4415f..8d7fc6805e9 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 (e)); } e->remove_all_references (); diff --git a/gcc/varpool.cc b/gcc/varpool.cc index 976e0fa60aa..8dc5f986294 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)