Commit 90190bb3 by Martin Liska Committed by Martin Liska

re PR ipa/64664 (ICE: tree check: expected function_decl, have <invalid tree…

re PR ipa/64664 (ICE: tree check: expected function_decl, have <invalid tree code> in opts_for_fn, at tree.h:4706)

Fix PR64664.

        PR ipa/64664
	* ipa-icf.c (sem_item_optimizer::filter_removed_items):
	Handle safe potentially removed nodes during filtering.

From-SVN: r219853
parent a9b8c959
2015-01-19 Martin Liska <mliska@suse.cz> 2015-01-19 Martin Liska <mliska@suse.cz>
PR ipa/64664
* ipa-icf.c (sem_item_optimizer::filter_removed_items):
Handle safe potentially removed nodes during filtering.
2015-01-19 Martin Liska <mliska@suse.cz>
* doc/extend.texi (no_icf): Add new attribute description. * doc/extend.texi (no_icf): Add new attribute description.
* ipa-icf.c (sem_item_optimizer::merge_classes): Handle cases * ipa-icf.c (sem_item_optimizer::merge_classes): Handle cases
where the pass attempts to merge a function with no_icf attribute. where the pass attempts to merge a function with no_icf attribute.
......
...@@ -1652,40 +1652,31 @@ sem_item_optimizer::filter_removed_items (void) ...@@ -1652,40 +1652,31 @@ sem_item_optimizer::filter_removed_items (void)
{ {
sem_item *item = m_items[i]; sem_item *item = m_items[i];
if (item->type == FUNC if (m_removed_items_set.contains (item->node))
&& !opt_for_fn (item->decl, flag_ipa_icf_functions)) {
{
remove_item (item);
continue;
}
if (!flag_ipa_icf_variables && item->type == VAR)
{
remove_item (item); remove_item (item);
continue; continue;
} }
bool no_body_function = false;
if (item->type == FUNC) if (item->type == FUNC)
{ {
cgraph_node *cnode = static_cast <sem_function *>(item)->get_node (); cgraph_node *cnode = static_cast <sem_function *>(item)->get_node ();
no_body_function = in_lto_p && (cnode->alias || cnode->body_removed); bool no_body_function = in_lto_p && (cnode->alias || cnode->body_removed);
} if (no_body_function || !opt_for_fn (item->decl, flag_ipa_icf_functions)
|| DECL_CXX_CONSTRUCTOR_P (item->decl)
if(!m_removed_items_set.contains (m_items[i]->node) || DECL_CXX_DESTRUCTOR_P (item->decl))
&& !no_body_function) remove_item (item);
{ else
if (item->type == VAR || (!DECL_CXX_CONSTRUCTOR_P (item->decl) filtered.safe_push (item);
&& !DECL_CXX_DESTRUCTOR_P (item->decl))) }
{ else /* VAR. */
filtered.safe_push (m_items[i]); {
continue; if (!flag_ipa_icf_variables)
} remove_item (item);
} else
filtered.safe_push (item);
remove_item (item); }
} }
/* Clean-up of released semantic items. */ /* Clean-up of released semantic items. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment