From: Richard Guenther Date: Tue, 19 Apr 2011 08:59:45 +0000 (+0000) Subject: re PR tree-optimization/46188 (-fipa-cp removes destructor call) X-Git-Tag: releases/gcc-4.5.3~61 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=77dfc76d8ec4263a8fb6a3e6200acda492f10777;p=thirdparty%2Fgcc.git re PR tree-optimization/46188 (-fipa-cp removes destructor call) 2011-04-19 Richard Guenther PR tree-optimization/46188 Backported from 4.6 branch 2010-05-26 Jan Hubicka * cgraphunit.c (clone_of_p): Remove. (verify_cgraph_node): Do not verify clones. (cgraph_materialize_all_clones): Do no redirection here. * ipa-inline.c (inline_transform): Do redirection here. From-SVN: r172698 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index ed43f1b5c008..9bcbfcb8bc03 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2011-04-19 Richard Guenther + + PR tree-optimization/46188 + Backported from 4.6 branch + 2010-05-26 Jan Hubicka + + * cgraphunit.c (clone_of_p): Remove. + (verify_cgraph_node): Do not verify clones. + (cgraph_materialize_all_clones): Do no redirection here. + * ipa-inline.c (inline_transform): Do redirection here. + 2011-04-18 Eric Botcazou * dwarf2out.c (is_redundant_typedef): Add 'inline' to prototype. diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c index 0bea59b52214..75c23a823d69 100644 --- a/gcc/cgraphunit.c +++ b/gcc/cgraphunit.c @@ -553,15 +553,6 @@ cgraph_mark_if_needed (tree decl) cgraph_mark_needed_node (node); } -/* Return TRUE if NODE2 is equivalent to NODE or its clone. */ -static bool -clone_of_p (struct cgraph_node *node, struct cgraph_node *node2) -{ - while (node != node2 && node2) - node2 = node2->clone_of; - return node2 != NULL; -} - /* Verify cgraph nodes of given cgraph node. */ void verify_cgraph_node (struct cgraph_node *node) @@ -777,16 +768,6 @@ verify_cgraph_node (struct cgraph_node *node) debug_tree (e->callee->decl); error_found = true; } - else if (!node->global.inlined_to - && !e->callee->global.inlined_to - && !clone_of_p (cgraph_node (decl), e->callee)) - { - error ("edge points to wrong declaration:"); - debug_tree (e->callee->decl); - fprintf (stderr," Instead of:"); - debug_tree (decl); - error_found = true; - } e->aux = (void *)1; } else @@ -2396,31 +2377,8 @@ cgraph_materialize_all_clones (void) for (node = cgraph_nodes; node; node = node->next) if (!node->analyzed && node->callees) cgraph_node_remove_callees (node); - if (cgraph_dump_file) - fprintf (cgraph_dump_file, "Updating call sites\n"); - for (node = cgraph_nodes; node; node = node->next) - if (node->analyzed && !node->clone_of - && gimple_has_body_p (node->decl)) - { - struct cgraph_edge *e; - - current_function_decl = node->decl; - push_cfun (DECL_STRUCT_FUNCTION (node->decl)); - for (e = node->callees; e; e = e->next_callee) - cgraph_redirect_edge_call_stmt_to_callee (e); - pop_cfun (); - current_function_decl = NULL; -#ifdef ENABLE_CHECKING - verify_cgraph_node (node); -#endif - } if (cgraph_dump_file) fprintf (cgraph_dump_file, "Materialization Call site updates done.\n"); - /* All changes to parameters have been performed. In order not to - incorrectly repeat them, we simply dispose of the bitmaps that drive the - changes. */ - for (node = cgraph_nodes; node; node = node->next) - node->clone.combined_args_to_skip = NULL; #ifdef ENABLE_CHECKING verify_cgraph (); #endif diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 8b2e3849a2a9..41a3d1b784ec 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -2092,6 +2092,7 @@ inline_transform (struct cgraph_node *node) { unsigned int todo = 0; struct cgraph_edge *e; + bool inline_p = false; /* FIXME: Currently the passmanager is adding inline transform more than once to some clones. This needs revisiting after WPA cleanups. */ @@ -2104,10 +2105,13 @@ inline_transform (struct cgraph_node *node) save_inline_function_body (node); for (e = node->callees; e; e = e->next_callee) - if (!e->inline_failed || warn_inline) - break; + { + cgraph_redirect_edge_call_stmt_to_callee (e); + if (!e->inline_failed || warn_inline) + inline_p = true; + } - if (e) + if (inline_p) { timevar_push (TV_INTEGRATION); todo = optimize_inline_calls (current_function_decl);