ipa-icf: skip variables with body_removed

Similarly to cgraph_nodes, it may happen that body_removed is set
during merging of symbols.

	PR ipa/105600

gcc/ChangeLog:

	* ipa-icf.cc (sem_item_optimizer::filter_removed_items):
	Skip variables with body_removed.
This commit is contained in:
Martin Liska 2022-05-18 15:07:53 +02:00
parent 7f52df186d
commit 31ce821a79

View File

@ -2411,10 +2411,11 @@ sem_item_optimizer::filter_removed_items (void)
{
/* Filter out non-readonly variables. */
tree decl = item->decl;
if (TREE_READONLY (decl))
filtered.safe_push (item);
else
varpool_node *vnode = static_cast <sem_variable *>(item)->get_node ();
if (!TREE_READONLY (decl) || vnode->body_removed)
remove_item (item);
else
filtered.safe_push (item);
}
}
}