summaryrefslogtreecommitdiff
path: root/gcc/cgraph.c
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-22 14:33:27 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2012-03-22 14:33:27 +0000
commit41710b76736db179e72878dd39a32ef0d4f2677e (patch)
tree03738d0312372fd214a53bbb313ffd06dbb04d03 /gcc/cgraph.c
parent1957dffb70bbcde6a29342f407e4982916e92eb9 (diff)
downloadgcc-41710b76736db179e72878dd39a32ef0d4f2677e.tar.gz
PR middle-end/51737
* cgraph.c (cgraph_remove_node_and_inline_clones): Add FORBIDDEN_NODE parameter. * cgraph.h (cgraph_remove_node_and_inline_clones): Update prototype. * ipa-inline-transform.c (save_inline_function_body): Remove copied clone if needed. * tree-inline.c (delete_unreachable_blocks_update_callgraph): Update. PR middle-end/51737 * g++.dg/torture/pr51737.C: New testcase git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@185694 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cgraph.c')
-rw-r--r--gcc/cgraph.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/gcc/cgraph.c b/gcc/cgraph.c
index 9cc36903a8c..7c44c059245 100644
--- a/gcc/cgraph.c
+++ b/gcc/cgraph.c
@@ -1639,19 +1639,27 @@ cgraph_add_to_same_comdat_group (struct cgraph_node *new_,
}
}
-/* Remove the node from cgraph. */
+/* Remove the node from cgraph and all inline clones inlined into it.
+ Skip however removal of FORBIDDEN_NODE and return true if it needs to be
+ removed. This allows to call the function from outer loop walking clone
+ tree. */
-void
-cgraph_remove_node_and_inline_clones (struct cgraph_node *node)
+bool
+cgraph_remove_node_and_inline_clones (struct cgraph_node *node, struct cgraph_node *forbidden_node)
{
struct cgraph_edge *e, *next;
+ bool found = false;
+
+ if (node == forbidden_node)
+ return true;
for (e = node->callees; e; e = next)
{
next = e->next_callee;
if (!e->inline_failed)
- cgraph_remove_node_and_inline_clones (e->callee);
+ found |= cgraph_remove_node_and_inline_clones (e->callee, forbidden_node);
}
cgraph_remove_node (node);
+ return found;
}
/* Notify finalize_compilation_unit that given node is reachable. */