aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Liska <mliska@suse.cz>2015-01-19 19:07:08 +0100
committerMartin Liska <marxin@gcc.gnu.org>2015-01-19 18:07:08 +0000
commit90190bb3ccf6809fc742f6d29459f4d30ef420e5 (patch)
tree40a6bdbb63a2a7d4ca8f90fece56705f29b5b99d
parenta9b8c95973d76f5070ddbdac4a0567ea51775da9 (diff)
downloadgcc-90190bb3ccf6809fc742f6d29459f4d30ef420e5.zip
gcc-90190bb3ccf6809fc742f6d29459f4d30ef420e5.tar.gz
gcc-90190bb3ccf6809fc742f6d29459f4d30ef420e5.tar.bz2
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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/ipa-icf.c47
2 files changed, 25 insertions, 28 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 48341c5..ac1e459 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,11 @@
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.
* ipa-icf.c (sem_item_optimizer::merge_classes): Handle cases
where the pass attempts to merge a function with no_icf attribute.
diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c
index a91fd98..afb5be5 100644
--- a/gcc/ipa-icf.c
+++ b/gcc/ipa-icf.c
@@ -1652,40 +1652,31 @@ sem_item_optimizer::filter_removed_items (void)
{
sem_item *item = m_items[i];
- if (item->type == FUNC
- && !opt_for_fn (item->decl, flag_ipa_icf_functions))
- {
- remove_item (item);
- continue;
- }
-
- if (!flag_ipa_icf_variables && item->type == VAR)
- {
+ if (m_removed_items_set.contains (item->node))
+ {
remove_item (item);
continue;
- }
-
- bool no_body_function = false;
+ }
if (item->type == FUNC)
- {
+ {
cgraph_node *cnode = static_cast <sem_function *>(item)->get_node ();
- no_body_function = in_lto_p && (cnode->alias || cnode->body_removed);
- }
-
- if(!m_removed_items_set.contains (m_items[i]->node)
- && !no_body_function)
- {
- if (item->type == VAR || (!DECL_CXX_CONSTRUCTOR_P (item->decl)
- && !DECL_CXX_DESTRUCTOR_P (item->decl)))
- {
- filtered.safe_push (m_items[i]);
- continue;
- }
- }
-
- remove_item (item);
+ 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)
+ || DECL_CXX_DESTRUCTOR_P (item->decl))
+ remove_item (item);
+ else
+ filtered.safe_push (item);
+ }
+ else /* VAR. */
+ {
+ if (!flag_ipa_icf_variables)
+ remove_item (item);
+ else
+ filtered.safe_push (item);
+ }
}
/* Clean-up of released semantic items. */