diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 637ef039cd8..3b4bdd40845 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2016-03-15 Tom de Vries + + PR ipa/70161 + * cgraph.c (cgraph_node::get_body): Save, reset and restore + dump_file_name. + * passes.c (execute_one_ipa_transform_pass): Add missing argument to + execute_function_dump. + (execute_one_pass): Don't dump function if it will be dumped after ipa + transform. + 2016-03-15 Segher Boessenkool * genrecog.c (match_pattern_2): If pred is NULL don't call diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 871ed62fd61..518ef24c54d 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3369,7 +3369,9 @@ cgraph_node::get_body (void) { opt_pass *saved_current_pass = current_pass; FILE *saved_dump_file = dump_file; + const char *saved_dump_file_name = dump_file_name; int saved_dump_flags = dump_flags; + dump_file_name = NULL; push_cfun (DECL_STRUCT_FUNCTION (decl)); execute_all_ipa_transforms (); @@ -3381,6 +3383,7 @@ cgraph_node::get_body (void) current_pass = saved_current_pass; dump_file = saved_dump_file; + dump_file_name = saved_dump_file_name; dump_flags = saved_dump_flags; } return updated; diff --git a/gcc/passes.c b/gcc/passes.c index 1bf89edc921..9d9025116f4 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -2214,7 +2214,7 @@ execute_one_ipa_transform_pass (struct cgraph_node *node, check_profile_consistency (pass->static_pass_number, 1, true); if (dump_file) - do_per_function (execute_function_dump, NULL); + do_per_function (execute_function_dump, pass); pass_fini_dump_file (pass); current_pass = NULL; @@ -2351,15 +2351,15 @@ execute_one_pass (opt_pass *pass) check_profile_consistency (pass->static_pass_number, 1, true); verify_interpass_invariants (); - if (dump_file) - do_per_function (execute_function_dump, pass); - if (pass->type == IPA_PASS) + if (pass->type == IPA_PASS + && ((ipa_opt_pass_d *)pass)->function_transform) { struct cgraph_node *node; - if (((ipa_opt_pass_d *)pass)->function_transform) - FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) - node->ipa_transforms_to_apply.safe_push ((ipa_opt_pass_d *)pass); + FOR_EACH_FUNCTION_WITH_GIMPLE_BODY (node) + node->ipa_transforms_to_apply.safe_push ((ipa_opt_pass_d *)pass); } + else if (dump_file) + do_per_function (execute_function_dump, pass); if (!current_function_decl) symtab->process_new_functions ();