Message ID | 56E6D97F.3030606@mentor.com |
---|---|
State | New |
Headers | show |
On Mon, 14 Mar 2016, Tom de Vries wrote: > Hi, > > this patch fixes PR70161, a 4.9/5/6 regression. > > Currently when using -fdump-ipa-all-graph, the compiler ICEs in > execute_function_dump when testing for pass->graph_dump_initialized, because > pass == NULL. > > The patch fixes: > - the ICE by setting the pass argument in the call to > execute_function_dump in execute_one_ipa_transform_pass > - a subsequent ICE (triggered with -fipa-pta) by saving, resetting and > restoring dump_file_name in cgraph_node::get_body, alongside the > saving and restoring of the dump_file variable. > - the duplicate edges in the subsequently generated dot file by > ensuring that execute_function_dump is called only once per function > per pass. [ Note that this bit also has an effect for the normal dump > files for the ipa passes with transform function. For those functions, > atm execute_function_dump is called both after execute and after > transform. With the patch, it's only called after transform. ] > > Bootstrapped and reg-tested on x86_64. > > OK for stage4? Ok. Thanks, Richard.
On 15/03/16 12:37, Richard Biener wrote: > On Mon, 14 Mar 2016, Tom de Vries wrote: > >> Hi, >> >> this patch fixes PR70161, a 4.9/5/6 regression. >> >> Currently when using -fdump-ipa-all-graph, the compiler ICEs in >> execute_function_dump when testing for pass->graph_dump_initialized, because >> pass == NULL. >> >> The patch fixes: >> - the ICE by setting the pass argument in the call to >> execute_function_dump in execute_one_ipa_transform_pass >> - a subsequent ICE (triggered with -fipa-pta) by saving, resetting and >> restoring dump_file_name in cgraph_node::get_body, alongside the >> saving and restoring of the dump_file variable. >> - the duplicate edges in the subsequently generated dot file by >> ensuring that execute_function_dump is called only once per function >> per pass. [ Note that this bit also has an effect for the normal dump >> files for the ipa passes with transform function. For those functions, >> atm execute_function_dump is called both after execute and after >> transform. With the patch, it's only called after transform. ] >> >> Bootstrapped and reg-tested on x86_64. >> >> OK for stage4? > > Ok. All of the patch also OK for 4.9/5 branch? [ The first 2 bits fix ICES. The last part fixes a duplicate edges problem in the dot file, I'm not sure if that's needed in the release branches. ] Thanks, - Tom
On Thu, 17 Mar 2016, Tom de Vries wrote: > On 15/03/16 12:37, Richard Biener wrote: > > On Mon, 14 Mar 2016, Tom de Vries wrote: > > > > > Hi, > > > > > > this patch fixes PR70161, a 4.9/5/6 regression. > > > > > > Currently when using -fdump-ipa-all-graph, the compiler ICEs in > > > execute_function_dump when testing for pass->graph_dump_initialized, > > > because > > > pass == NULL. > > > > > > The patch fixes: > > > - the ICE by setting the pass argument in the call to > > > execute_function_dump in execute_one_ipa_transform_pass > > > - a subsequent ICE (triggered with -fipa-pta) by saving, resetting and > > > restoring dump_file_name in cgraph_node::get_body, alongside the > > > saving and restoring of the dump_file variable. > > > - the duplicate edges in the subsequently generated dot file by > > > ensuring that execute_function_dump is called only once per function > > > per pass. [ Note that this bit also has an effect for the normal dump > > > files for the ipa passes with transform function. For those functions, > > > atm execute_function_dump is called both after execute and after > > > transform. With the patch, it's only called after transform. ] > > > > > > Bootstrapped and reg-tested on x86_64. > > > > > > OK for stage4? > > > > Ok. > > All of the patch also OK for 4.9/5 branch? Yes, after a few days on trunk w/o issues. Richard. > [ The first 2 bits fix ICES. The last part fixes a duplicate edges problem in > the dot file, I'm not sure if that's needed in the release branches. ] > > Thanks, > - Tom > > > >
Fix fdump-ipa-all-graph 2016-03-14 Tom de Vries <tom@codesourcery.com> 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. --- gcc/cgraph.c | 3 +++ gcc/passes.c | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 7727313..f187913 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3365,7 +3365,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 (); @@ -3377,6 +3379,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 bbe35b3..5aa2b32 100644 --- a/gcc/passes.c +++ b/gcc/passes.c @@ -2219,7 +2219,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; @@ -2356,15 +2356,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 ();