From d050bafd156a2ec8ce1382590158b853acf1c6ee Mon Sep 17 00:00:00 2001 From: hubicka Date: Sat, 18 Sep 2010 23:13:17 +0000 Subject: PR tree-optimization/45453 * cgraphunit.c (cgraph_finalize_function): Consider comdat & external virtual functions are reachable. * ipa-inline.c (cgraph_clone_inlined_nodes): Likewise. * ipa.c (cgraph_remove_unreachable_nodes): Likewise. * ipa-prop.c (ipa_modify_formal_parameters): Clear DECL_VIRTUAL_P when modifying function. * g++.dg/tree-ssa/pr45453.C: New testcase. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@164405 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ipa-inline.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'gcc/ipa-inline.c') diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 964d03ba21a..21e0b647973 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -251,6 +251,12 @@ cgraph_clone_inlined_nodes (struct cgraph_edge *e, bool duplicate, In that case just go ahead and re-use it. */ if (!e->callee->callers->next_caller && cgraph_can_remove_if_no_direct_calls_p (e->callee) + /* Inlining might enable more devirtualizing, so we want to remove + those only after all devirtualizable virtual calls are processed. + Lacking may edges in callgraph we just preserve them post + inlining. */ + && (!DECL_VIRTUAL_P (e->callee->decl) + || (!DECL_COMDAT (e->callee->decl) && !DECL_EXTERNAL (e->callee->decl))) /* Don't reuse if more than one function shares a comdat group. If the other function(s) are needed, we need to emit even this function out of line. */ -- cgit v1.2.1