https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85656
--- Comment #7 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot Uni-Bielefeld.DE> --- > --- Comment #6 from Martin Liška <marxin at gcc dot gnu.org> --- [...] > So can you please debug why we go into following branch: > 1277 if (!create_wrapper > 1278 && !alias->call_for_symbol_and_aliases > (cgraph_node::has_thunk_p, > 1279 NULL, true) > 1280 && !alias->can_remove_if_no_direct_calls_p ()) > 1281 { > 1282 if (dump_file) > 1283 fprintf (dump_file, "Not unifying; can not make wrapper > and > " > 1284 "function has other uses than direct calls\n\n"); > 1285 return false; > 1286 } > > I'm curious why can_remove_if_no_direct_calls_p returns false. It took me a bit figuring out which of the two lto1 invocations was the interesting one, then rebuilding with -g3 -O0 to be able to see anything useful in gdb. Here's what I found: ipa-icf.c:1280 (sem_function::merge) && !alias->can_remove_if_no_direct_calls_p ()) cgraph.c:2848 (cgraph_node::can_remove_if_no_direct_calls_p) return !call_for_symbol_and_aliases (nonremovable_p, NULL, true); cgraph.h:3213 (cgraph_node::call_for_symbol_and_aliases) if (callback (this, data)) return true; cgraph.c:2829 (nonremovable_p) return !node->can_remove_if_no_direct_calls_and_refs_p (); cgraph.h:2924 (cgraph_node::can_remove_if_no_direct_calls_and_refs_p) /* Only COMDAT functions can be removed if externally visible. */ if (externally_visible && (!DECL_COMDAT (decl) || forced_by_abi || used_from_object_file_p ())) return false; externally_visible = 1 and If I'm not mistaken, decl is not comdat, thus return false: <function_decl fa527880 bar type <function_type fa524ea0 type <integer_type faefb3c0 int public SI size <integer_cst fa405910 constant 32> unit-size <integer_cst fa405924 constant 4> align:32 warn_if_not_align:0 symtab:0 alias-set 1 canonical-type faefb3c0 precision:32 min <integer_cst fa405af0 -2147483648> max <integer_cst fa405b04 2147483647> pointer_to_this <pointer_type fa419060>> QI size <integer_cst fa405a14 constant 8> unit-size <integer_cst fa405a28 constant 1> align:8 warn_if_not_align:0 symtab:0 alias-set -1 structural-equality arg-types <tree_list fa41c000 value <void_type faefb9c0 void>> pointer_to_this <pointer_type fa524120>> readonly addressable nothrow public static function-specific-target function-specific-opt uninlinable QI /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/ipa/ipa-icf-38a.c:6:5 align:8 warn_if_not_align:0 context <translation_unit_decl fa40f63c /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/ipa/ipa-icf-38a.c> attributes <tree_list fa526390 purpose <identifier_node fa5239f4 noinline>> initial <block fa52a0e0> result <result_decl fa40f6d4 D.4264 type <integer_type faefb3c0 int> ignored SI /vol/gcc/src/hg/trunk/local/gcc/testsuite/gcc.dg/ipa/ipa-icf-38a.c:6:5 size <integer_cst fa405910 32> unit-size <integer_cst fa405924 4> align:32 warn_if_not_align:0 context <function_decl fa527880 bar>> struct-function fa52b1a0>