Re: [PATCH] Introduce symtab_node::dump_{asm_,}name functions.
On 05/19/2017 04:41 PM, Jan Hubicka wrote: We used to have fixed size cyclic buffer for those strings, so it was safe to invoke name/asm_name few times and still expect the result to be there. I wonder what happened to those? Using ggc is bit ugly here, but I suppose it is OK for debug output... Ok, I see, I'm going to install the patch and we'll see how that can impact memory usage at the end of GCC 8 stage 4. Martin
Re: [PATCH] Introduce symtab_node::dump_{asm_,}name functions.
> Hello. > > We repeat all over following patterns: > > fprintf (dump_file, "Removing speculative call %s/%i => %s/%i\n", > xstrdup_for_dump (edge->caller->name ()), > edge->caller->order, > xstrdup_for_dump (e2->callee->name ()), > e2->callee->order); > > As we already wrap name() and asm_name() with xstrdup_for_dump and the pattern > of 'name/order' is very common, I suggest to come up with helper functions > that > do that. > > Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. We used to have fixed size cyclic buffer for those strings, so it was safe to invoke name/asm_name few times and still expect the result to be there. I wonder what happened to those? Using ggc is bit ugly here, but I suppose it is OK for debug output... Honza > > Ready to be installed? > Martin > >From 42a746e3db58e24cbd3a4b45ab3f9150fad44928 Mon Sep 17 00:00:00 2001 > From: marxin <mli...@suse.cz> > Date: Fri, 19 May 2017 14:09:25 +0200 > Subject: [PATCH] Introduce symtab_node::dump_{asm_,}name functions. > > gcc/ChangeLog: > > 2017-05-19 Martin Liska <mli...@suse.cz> > > * cgraph.c (cgraph_node::get_create): Use symtab_node::dump_{asm_,}name > functions. > (cgraph_edge::make_speculative): Likewise. > (cgraph_edge::resolve_speculation): Likewise. > (cgraph_edge::redirect_call_stmt_to_callee): Likewise. > (cgraph_node::dump): Likewise. > * cgraph.h: Likewise. > * cgraphunit.c (analyze_functions): Likewise. > (symbol_table::compile): Likewise. > * ipa-cp.c (print_all_lattices): Likewise. > (determine_versionability): Likewise. > (initialize_node_lattices): Likewise. > (ipcp_verify_propagated_values): Likewise. > (estimate_local_effects): Likewise. > (update_profiling_info): Likewise. > (create_specialized_node): Likewise. > (perhaps_add_new_callers): Likewise. > (decide_about_value): Likewise. > (decide_whether_version_node): Likewise. > (identify_dead_nodes): Likewise. > (ipcp_store_bits_results): Likewise. > * ipa-devirt.c (dump_targets): Likewise. > (ipa_devirt): Likewise. > * ipa-icf.c (sem_item::dump): Likewise. > (sem_function::equals): Likewise. > (sem_variable::equals): Likewise. > (sem_item_optimizer::read_section): Likewise. > (sem_item_optimizer::execute): Likewise. > (congruence_class::dump): Likewise. > * ipa-inline-analysis.c (dump_ipa_call_summary): Likewise. > (dump_inline_summary): Likewise. > (estimate_node_size_and_time): Likewise. > (inline_analyze_function): Likewise. > * ipa-inline-transform.c (inline_call): Likewise. > * ipa-inline.c (report_inline_failed_reason): Likewise. > (want_early_inline_function_p): Likewise. > (edge_badness): Likewise. > (update_edge_key): Likewise. > (inline_small_functions): Likewise. > * ipa-profile.c (ipa_profile): Likewise. > * ipa-prop.c (ipa_print_node_jump_functions): Likewise. > (ipa_make_edge_direct_to_target): Likewise. > (remove_described_reference): Likewise. > (ipa_impossible_devirt_target): Likewise. > (propagate_controlled_uses): Likewise. > (ipa_print_node_params): Likewise. > (ipcp_transform_function): Likewise. > * ipa-pure-const.c (pure_const_read_summary): Likewise. > (propagate_pure_const): Likewise. > * ipa-reference.c (generate_summary): Likewise. > (read_write_all_from_decl): Likewise. > (propagate): Likewise. > (ipa_reference_read_optimization_summary): Likewise. > * ipa-utils.c (ipa_merge_profiles): Likewise. > * ipa.c (walk_polymorphic_call_targets): Likewise. > (symbol_table::remove_unreachable_nodes): Likewise. > (ipa_single_use): Likewise. > * passes.c (execute_todo): Likewise. > * predict.c (drop_profile): Likewise. > * symtab.c (symtab_node::get_dump_name): New function. > (symtab_node::dump_name): Likewise. > (symtab_node::dump_asm_name): Likewise. > (symtab_node::dump_references): Likewise. > (symtab_node::dump_referring): Likewise. > (symtab_node::dump_base): Likewise. > (symtab_node::debug_symtab): Likewise. > * tree-sra.c (convert_callers_for_node): Likewise. > * tree-ssa-structalias.c (ipa_pta_execute): Likewise. > * value-prof.c (init_node_map): Likewise. > > gcc/lto/ChangeLog: > > 2017-05-19 Martin Liska <mli...@suse.cz> &
[PATCH] Introduce symtab_node::dump_{asm_,}name functions.
Hello. We repeat all over following patterns: fprintf (dump_file, "Removing speculative call %s/%i => %s/%i\n", xstrdup_for_dump (edge->caller->name ()), edge->caller->order, xstrdup_for_dump (e2->callee->name ()), e2->callee->order); As we already wrap name() and asm_name() with xstrdup_for_dump and the pattern of 'name/order' is very common, I suggest to come up with helper functions that do that. Patch can bootstrap on ppc64le-redhat-linux and survives regression tests. Ready to be installed? Martin >From 42a746e3db58e24cbd3a4b45ab3f9150fad44928 Mon Sep 17 00:00:00 2001 From: marxin <mli...@suse.cz> Date: Fri, 19 May 2017 14:09:25 +0200 Subject: [PATCH] Introduce symtab_node::dump_{asm_,}name functions. gcc/ChangeLog: 2017-05-19 Martin Liska <mli...@suse.cz> * cgraph.c (cgraph_node::get_create): Use symtab_node::dump_{asm_,}name functions. (cgraph_edge::make_speculative): Likewise. (cgraph_edge::resolve_speculation): Likewise. (cgraph_edge::redirect_call_stmt_to_callee): Likewise. (cgraph_node::dump): Likewise. * cgraph.h: Likewise. * cgraphunit.c (analyze_functions): Likewise. (symbol_table::compile): Likewise. * ipa-cp.c (print_all_lattices): Likewise. (determine_versionability): Likewise. (initialize_node_lattices): Likewise. (ipcp_verify_propagated_values): Likewise. (estimate_local_effects): Likewise. (update_profiling_info): Likewise. (create_specialized_node): Likewise. (perhaps_add_new_callers): Likewise. (decide_about_value): Likewise. (decide_whether_version_node): Likewise. (identify_dead_nodes): Likewise. (ipcp_store_bits_results): Likewise. * ipa-devirt.c (dump_targets): Likewise. (ipa_devirt): Likewise. * ipa-icf.c (sem_item::dump): Likewise. (sem_function::equals): Likewise. (sem_variable::equals): Likewise. (sem_item_optimizer::read_section): Likewise. (sem_item_optimizer::execute): Likewise. (congruence_class::dump): Likewise. * ipa-inline-analysis.c (dump_ipa_call_summary): Likewise. (dump_inline_summary): Likewise. (estimate_node_size_and_time): Likewise. (inline_analyze_function): Likewise. * ipa-inline-transform.c (inline_call): Likewise. * ipa-inline.c (report_inline_failed_reason): Likewise. (want_early_inline_function_p): Likewise. (edge_badness): Likewise. (update_edge_key): Likewise. (inline_small_functions): Likewise. * ipa-profile.c (ipa_profile): Likewise. * ipa-prop.c (ipa_print_node_jump_functions): Likewise. (ipa_make_edge_direct_to_target): Likewise. (remove_described_reference): Likewise. (ipa_impossible_devirt_target): Likewise. (propagate_controlled_uses): Likewise. (ipa_print_node_params): Likewise. (ipcp_transform_function): Likewise. * ipa-pure-const.c (pure_const_read_summary): Likewise. (propagate_pure_const): Likewise. * ipa-reference.c (generate_summary): Likewise. (read_write_all_from_decl): Likewise. (propagate): Likewise. (ipa_reference_read_optimization_summary): Likewise. * ipa-utils.c (ipa_merge_profiles): Likewise. * ipa.c (walk_polymorphic_call_targets): Likewise. (symbol_table::remove_unreachable_nodes): Likewise. (ipa_single_use): Likewise. * passes.c (execute_todo): Likewise. * predict.c (drop_profile): Likewise. * symtab.c (symtab_node::get_dump_name): New function. (symtab_node::dump_name): Likewise. (symtab_node::dump_asm_name): Likewise. (symtab_node::dump_references): Likewise. (symtab_node::dump_referring): Likewise. (symtab_node::dump_base): Likewise. (symtab_node::debug_symtab): Likewise. * tree-sra.c (convert_callers_for_node): Likewise. * tree-ssa-structalias.c (ipa_pta_execute): Likewise. * value-prof.c (init_node_map): Likewise. gcc/lto/ChangeLog: 2017-05-19 Martin Liska <mli...@suse.cz> * lto-symtab.c (lto_cgraph_replace_node): Use symtab_node::dump_{asm_,}name functions. * lto.c (read_cgraph_and_symbols): Likewise. (do_whole_program_analysis): Likewise. --- gcc/cgraph.c | 75 ++ gcc/cgraph.h | 11 +- gcc/ipa-cp.c | 51 +++--- gcc/ipa-devirt.c | 15 gcc/ipa-icf.c | 31 ++-- gcc/ipa-inline-analysis.c | 15 gcc/ipa-inline-transform.c | 8 ++--- gcc/ipa-inline.c | 63 ++-- gcc/ipa-profile.c | 6 ++-- gcc/ipa-prop.c | 90 +++--- gcc/ipa-pure-const.c | 15 +++- gcc/ipa-reference.c| 27 ++ gcc/ipa-utils.c| 5 ++- gcc/ipa.c | 20 +-- gcc/lto/lto-symtab.c | 7 ++-- gcc/predict.c | 14 gcc/symtab.c | 42 -- gcc/tree-sra.c | 7 ++-- gcc/value-prof.c | 19 -- 19 files changed, 229 insert