From 17e0fc9202d9edf96a8c70e54f9a105f8d477016 Mon Sep 17 00:00:00 2001 From: Jan Hubicka Date: Thu, 11 Dec 2014 22:48:48 +0100 Subject: re PR ipa/61324 (ICE: SIGSEGV at ipa-comdats.c:321 with -fno-use-cxa-atexit -fkeep-inline-functions) PR ipa/61324 * testsuite/g++.dg/pr61324.C: New testcase by Trevor Saunders. * testsuite/g++.dg/tm/pr51411-2.C: Update se the extern function is not eliminated early. * testsuite/gcc.target/i386/pr57756.c: Turn extern inline into static inline. * passes.c (execute_todo): Update call of remove_unreachable_nodes. * ipa-chkp.c (chkp_produce_thunks): Use TODO_remove_functions. * cgraphunit.c (symbol_table::process_new_functions): Add IPA_SSA_AFTER_INLINING. (ipa_passes): Update call of remove_unreachable_nodes. (symbol_table::compile): Remove call of remove_unreachable_nodes. * ipa-inline.c (inline_small_functions): Do not ICE with -flto-partition=none (ipa_inline): Update symtab->state; fix formatting update call of remove_unreachable_nodes. * cgraphclones.c (symbol_table::materialize_all_clones): Likewise. * cgraph.h (enum symtab_state): Add IPA_SSA_AFTER_INLINING. (remove_unreachable_nodes): Update. * ipa.c (process_references): Keep external references only when optimizing. (walk_polymorphic_call_targets): Keep possible polymorphic call target only when devirtualizing. (symbol_table::remove_unreachable_nodes): Remove BEFORE_INLINING_P parameter. (ipa_single_use): Update comment. * ipa-pure-const.c (cdtor_p): New function. (propagate_pure_const): Track if some cdtor was turned pure/const. (execute): Return TODO_remove_functions if needed. * ipa-comdats.c (ipa_comdats): Update comment. * lto.c (read_cgraph_and_symbols): Update call of remove_unreachable_nodes. (do_whole_program_analysis): Remove call of symtab->remove_unreachable_nodes From-SVN: r218640 --- gcc/ipa-inline.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'gcc/ipa-inline.c') diff --git a/gcc/ipa-inline.c b/gcc/ipa-inline.c index 9f600b0..8954e49 100644 --- a/gcc/ipa-inline.c +++ b/gcc/ipa-inline.c @@ -1731,9 +1731,9 @@ inline_small_functions (void) " to be inlined into %s/%i in %s:%i\n" " Estimated badness is %"PRId64", frequency %.2f.\n", edge->caller->name (), edge->caller->order, - flag_wpa ? "unknown" + edge->call_stmt ? "unknown" : gimple_filename ((const_gimple) edge->call_stmt), - flag_wpa ? -1 + edge->call_stmt ? -1 : gimple_lineno ((const_gimple) edge->call_stmt), badness.to_int (), edge->frequency / (double)CGRAPH_FREQ_BASE); @@ -2188,9 +2188,12 @@ ipa_inline (void) inline_small_functions (); - /* Do first after-inlining removal. We want to remove all "stale" extern inline - functions and virtual functions so we really know what is called once. */ - symtab->remove_unreachable_nodes (false, dump_file); + gcc_assert (symtab->state == IPA_SSA); + symtab->state = IPA_SSA_AFTER_INLINING; + /* Do first after-inlining removal. We want to remove all "stale" extern + inline functions and virtual functions so we really know what is called + once. */ + symtab->remove_unreachable_nodes (dump_file); free (order); /* Inline functions with a property that after inlining into all callers the @@ -2199,7 +2202,8 @@ ipa_inline (void) are met. */ if (dump_file) fprintf (dump_file, - "\nDeciding on functions to be inlined into all callers and removing useless speculations:\n"); + "\nDeciding on functions to be inlined into all callers and " + "removing useless speculations:\n"); /* Inlining one function called once has good chance of preventing inlining other function into the same callee. Ideally we should @@ -2247,10 +2251,11 @@ ipa_inline (void) int num_calls = 0; node->call_for_symbol_thunks_and_aliases (sum_callers, &num_calls, true); - while (node->call_for_symbol_thunks_and_aliases (inline_to_all_callers, - &num_calls, true)) + while (node->call_for_symbol_thunks_and_aliases + (inline_to_all_callers, &num_calls, true)) ; - remove_functions = true; + if (num_calls) + remove_functions = true; } } } -- cgit v1.1