diff options
Diffstat (limited to 'gcc/tree-optimize.c')
-rw-r--r-- | gcc/tree-optimize.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/gcc/tree-optimize.c b/gcc/tree-optimize.c index f1957ab..e42fa06 100644 --- a/gcc/tree-optimize.c +++ b/gcc/tree-optimize.c @@ -65,13 +65,13 @@ clear_decl_rtl (tree *tp, int *walk_subtrees ATTRIBUTE_UNUSED, void *data) { case VAR_DECL: nonstatic_p = !TREE_STATIC (t) && !DECL_EXTERNAL (t); - local_p = DECL_CONTEXT (t) == data; + local_p = decl_function_context (t) == data; break; case PARM_DECL: case LABEL_DECL: nonstatic_p = true; - local_p = DECL_CONTEXT (t) == data; + local_p = decl_function_context (t) == data; break; case RESULT_DECL: @@ -205,18 +205,22 @@ tree_rest_of_compilation (tree fndecl, bool nested_p) walk_tree_without_duplicates (&DECL_SAVED_TREE (fndecl), clear_decl_rtl, fndecl); - - if (DECL_SAVED_INSNS (fndecl) == 0 && !nested_p && !flag_inline_trees) + if (!cgraph_function_possibly_inlined_p (fndecl)) { - /* Stop pointing to the local nodes about to be freed. - But DECL_INITIAL must remain nonzero so we know this - was an actual function definition. - For a nested function, this is done in c_pop_function_context. - If rest_of_compilation set this to 0, leave it 0. */ - if (DECL_INITIAL (fndecl) != 0) - DECL_INITIAL (fndecl) = error_mark_node; - - DECL_ARGUMENTS (fndecl) = 0; + DECL_SAVED_TREE (fndecl) = NULL; + if (DECL_SAVED_INSNS (fndecl) == 0 + && !cgraph_node (fndecl)->origin) + { + /* Stop pointing to the local nodes about to be freed. + But DECL_INITIAL must remain nonzero so we know this + was an actual function definition. + For a nested function, this is done in c_pop_function_context. + If rest_of_compilation set this to 0, leave it 0. */ + if (DECL_INITIAL (fndecl) != 0) + DECL_INITIAL (fndecl) = error_mark_node; + + DECL_ARGUMENTS (fndecl) = 0; + } } input_location = saved_loc; |