Commit 8222c37e by Martin Jambor Committed by Martin Jambor

re PR tree-optimization/55264 (ICE: in ipa_make_edge_direct_to_target, at…

re PR tree-optimization/55264 (ICE: in ipa_make_edge_direct_to_target, at ipa-prop.c:2141 with -O2 -fno-early-inlining -fno-weak)

2013-01-17  Martin Jambor  <mjambor@suse.cz>

	PR tree-optimizations/55264
	* ipa-inline-transform.c (can_remove_node_now_p_1): Never return true
	for virtual methods.
	* ipa.c (symtab_remove_unreachable_nodes): Never return true for
	virtual methods before inlining is over.
	* cgraph.h (cgraph_only_called_directly_or_aliased_p): Return false for
	virtual functions.
	* cgraphclones.c (cgraph_create_virtual_clone): Mark clones as
	non-virtual.

testsuite/
	* g++.dg/ipa/pr55264.C: New test.

From-SVN: r195262
parent c5e7e996
2013-01-17 Martin Jambor <mjambor@suse.cz>
PR tree-optimizations/55264
* ipa-inline-transform.c (can_remove_node_now_p_1): Never return true
for virtual methods.
* ipa.c (symtab_remove_unreachable_nodes): Never return true for
virtual methods before inlining is over.
* cgraph.h (cgraph_only_called_directly_or_aliased_p): Return false for
virtual functions.
* cgraphclones.c (cgraph_create_virtual_clone): Mark clones as
non-virtual.
2013-01-16 Vladimir Makarov <vmakarov@redhat.com> 2013-01-16 Vladimir Makarov <vmakarov@redhat.com>
PR rtl-optimization/56005 PR rtl-optimization/56005
......
...@@ -1164,6 +1164,7 @@ cgraph_only_called_directly_or_aliased_p (struct cgraph_node *node) ...@@ -1164,6 +1164,7 @@ cgraph_only_called_directly_or_aliased_p (struct cgraph_node *node)
gcc_assert (!node->global.inlined_to); gcc_assert (!node->global.inlined_to);
return (!node->symbol.force_output && !node->symbol.address_taken return (!node->symbol.force_output && !node->symbol.address_taken
&& !node->symbol.used_from_other_partition && !node->symbol.used_from_other_partition
&& !DECL_VIRTUAL_P (node->symbol.decl)
&& !DECL_STATIC_CONSTRUCTOR (node->symbol.decl) && !DECL_STATIC_CONSTRUCTOR (node->symbol.decl)
&& !DECL_STATIC_DESTRUCTOR (node->symbol.decl) && !DECL_STATIC_DESTRUCTOR (node->symbol.decl)
&& !node->symbol.externally_visible); && !node->symbol.externally_visible);
......
...@@ -319,6 +319,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node, ...@@ -319,6 +319,7 @@ cgraph_create_virtual_clone (struct cgraph_node *old_node,
TREE_PUBLIC (new_node->symbol.decl) = 0; TREE_PUBLIC (new_node->symbol.decl) = 0;
DECL_COMDAT (new_node->symbol.decl) = 0; DECL_COMDAT (new_node->symbol.decl) = 0;
DECL_WEAK (new_node->symbol.decl) = 0; DECL_WEAK (new_node->symbol.decl) = 0;
DECL_VIRTUAL_P (new_node->symbol.decl) = 0;
DECL_STATIC_CONSTRUCTOR (new_node->symbol.decl) = 0; DECL_STATIC_CONSTRUCTOR (new_node->symbol.decl) = 0;
DECL_STATIC_DESTRUCTOR (new_node->symbol.decl) = 0; DECL_STATIC_DESTRUCTOR (new_node->symbol.decl) = 0;
new_node->clone.tree_map = tree_map; new_node->clone.tree_map = tree_map;
......
...@@ -92,9 +92,7 @@ can_remove_node_now_p_1 (struct cgraph_node *node) ...@@ -92,9 +92,7 @@ can_remove_node_now_p_1 (struct cgraph_node *node)
those only after all devirtualizable virtual calls are processed. those only after all devirtualizable virtual calls are processed.
Lacking may edges in callgraph we just preserve them post Lacking may edges in callgraph we just preserve them post
inlining. */ inlining. */
&& (!DECL_VIRTUAL_P (node->symbol.decl) && !DECL_VIRTUAL_P (node->symbol.decl)
|| (!DECL_COMDAT (node->symbol.decl)
&& !DECL_EXTERNAL (node->symbol.decl)))
/* During early inlining some unanalyzed cgraph nodes might be in the /* During early inlining some unanalyzed cgraph nodes might be in the
callgraph and they might reffer the function in question. */ callgraph and they might reffer the function in question. */
&& !cgraph_new_nodes); && !cgraph_new_nodes);
......
...@@ -241,8 +241,7 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file) ...@@ -241,8 +241,7 @@ symtab_remove_unreachable_nodes (bool before_inlining_p, FILE *file)
&& (!cgraph_can_remove_if_no_direct_calls_and_refs_p (node) && (!cgraph_can_remove_if_no_direct_calls_and_refs_p (node)
/* Keep around virtual functions for possible devirtualization. */ /* Keep around virtual functions for possible devirtualization. */
|| (before_inlining_p || (before_inlining_p
&& DECL_VIRTUAL_P (node->symbol.decl) && DECL_VIRTUAL_P (node->symbol.decl))))
&& (DECL_COMDAT (node->symbol.decl) || DECL_EXTERNAL (node->symbol.decl)))))
{ {
gcc_assert (!node->global.inlined_to); gcc_assert (!node->global.inlined_to);
pointer_set_insert (reachable, node); pointer_set_insert (reachable, node);
......
2013-01-17 Martin Jambor <mjambor@suse.cz>
PR tree-optimizations/55264
* g++.dg/ipa/pr55264.C: New test.
2013-01-16 Janus Weil <janus@gcc.gnu.org> 2013-01-16 Janus Weil <janus@gcc.gnu.org>
PR fortran/55983 PR fortran/55983
......
/* { dg-do compile } */
/* { dg-options "-O2 -fno-early-inlining -fno-weak" } */
struct S
{
S();
virtual inline void foo ()
{
foo();
}
};
void
B ()
{
S().foo ();
}
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