diff options
author | Jan Hubicka <jh@suse.cz> | 2006-07-26 22:17:32 +0200 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2006-07-26 20:17:32 +0000 |
commit | 96fc428c75cc0b52a53f6f8231be83dd78dcec4e (patch) | |
tree | 067f3bb521f2fed42cb3fd52c2a69fe71a9ac756 /gcc/ipa-inline.c | |
parent | 88c4be5e484663d65d6e95c07e49d91dfa36f57e (diff) | |
download | gcc-96fc428c75cc0b52a53f6f8231be83dd78dcec4e.zip gcc-96fc428c75cc0b52a53f6f8231be83dd78dcec4e.tar.gz gcc-96fc428c75cc0b52a53f6f8231be83dd78dcec4e.tar.bz2 |
re PR tree-optimization/27882 (segfault in ipa-inline.c, if (e->callee->local.disregard_inline_limits)
PR tree-optimization/27882
* cgraph.c (cgraph_remove_node): Clear needed, reachable, next, previous
and decl fields.
* cgraphunit.c (cgraph_reset_node): Expect cgraph_remove_node to kill
next pointer
(cgraph_analyze_compilation_unit): Likewise.
* ipa.c (cgraph_remove_unreachable_nodes): Likewise.
* ipa-inline.c (cgraph_decide_recursive_inlining): Likewise.
(cgraph_early_inlinine): Make order garbage collected.
* Makefile.in (gt-ipa-inline): New garbagecollected file.
From-SVN: r115763
Diffstat (limited to 'gcc/ipa-inline.c')
-rw-r--r-- | gcc/ipa-inline.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index d2cdce2..6bbfcf0 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -570,7 +570,7 @@ cgraph_decide_recursive_inlining (struct cgraph_node *node) int probability = PARAM_VALUE (PARAM_MIN_INLINE_RECURSIVE_PROBABILITY); fibheap_t heap; struct cgraph_edge *e; - struct cgraph_node *master_clone; + struct cgraph_node *master_clone, *next; int depth = 0; int n = 0; @@ -671,9 +671,12 @@ cgraph_decide_recursive_inlining (struct cgraph_node *node) into master clone gets queued just before master clone so we don't need recursion. */ for (node = cgraph_nodes; node != master_clone; - node = node->next) - if (node->global.inlined_to == master_clone) - cgraph_remove_node (node); + node = next) + { + next = node->next; + if (node->global.inlined_to == master_clone) + cgraph_remove_node (node); + } cgraph_remove_node (master_clone); /* FIXME: Recursive inlining actually reduces number of calls of the function. At this place we should probably walk the function and @@ -1150,6 +1153,12 @@ struct tree_opt_pass pass_ipa_inline = 0 /* letter */ }; +/* Because inlining might remove no-longer reachable nodes, we need to + keep the array visible to garbage collector to avoid reading collected + out nodes. */ +static int nnodes; +static GTY ((length ("nnodes"))) struct cgraph_node **order; + /* Do inlining of small functions. Doing so early helps profiling and other passes to be somewhat more effective and avoids some code duplication in later real inlining pass for testcases with very many function calls. */ @@ -1157,9 +1166,6 @@ static unsigned int cgraph_early_inlining (void) { struct cgraph_node *node; - int nnodes; - struct cgraph_node **order = - XCNEWVEC (struct cgraph_node *, cgraph_n_nodes); int i; if (sorrycount || errorcount) @@ -1169,6 +1175,7 @@ cgraph_early_inlining (void) gcc_assert (!node->aux); #endif + order = ggc_alloc (sizeof (*order) * cgraph_n_nodes); nnodes = cgraph_postorder (order); for (i = nnodes - 1; i >= 0; i--) { @@ -1186,7 +1193,9 @@ cgraph_early_inlining (void) for (node = cgraph_nodes; node; node = node->next) gcc_assert (!node->global.inlined_to); #endif - free (order); + ggc_free (order); + order = NULL; + nnodes = 0; return 0; } @@ -1213,3 +1222,5 @@ struct tree_opt_pass pass_early_ipa_inline = TODO_dump_cgraph | TODO_dump_func, /* todo_flags_finish */ 0 /* letter */ }; + +#include "gt-ipa-inline.h" |