https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64801
--- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> ---
You are right, the problem is hidden in cooperation between IPA inliner and
ICF.
If I run the test w/o ICF, inliner sets NULL to the fsp_detect FUNCTION_DECL:
#0 0x000000000074541e in symtab_node::unregister (this=0x7ffff6c47620) at
../../gcc/symtab.c:407
#1 0x000000000074b0ef in cgraph_node::remove (this=0x7ffff6c47620) at
../../gcc/cgraph.c:1741
#2 0x0000000000b891b9 in expand_call_inline (id=0x7fffffffd5c0,
stmt=0x7ffff6d54aa0, bb=<optimized out>)
at ../../gcc/tree-inline.c:4762
#3 gimple_expand_calls_inline (id=0x7fffffffd5c0, bb=<optimized out>) at
../../gcc/tree-inline.c:4787
so that cgraph_node::get(decl) == NULL here:
if (symtab->state != LTO_STREAMING)
│1784 {
B+>│1785 n = cgraph_node::get (decl);
│1786 if (!n
│1787 || (!n->clones && !n->clone_of && !n->global.inlined_to
│1788 && (symtab->global_info_ready
│1789 && (TREE_ASM_WRITTEN (n->decl)
│1790 || DECL_EXTERNAL (n->decl)
│1791 || !n->analyzed
│1792 || (!flag_wpa && n->in_other_partition)))))
│1793 release_body ();
│1794 }
That's the reason why the body is not removed. On the contrary, with ICF,
aforementioned condition is satisfied and fsp_detect's body is removed.
I think the situation after IPA ICF is correct:
fsp_detect/2 (fsp_detect) @0x7ffff6c47620
Type: function definition analyzed
Visibility: external public
References:
Referring:
Availability: available
First run: 0
Function flags: body
Called by: elantech_detect/1 (1.00 per call) psmouse_extensions/3 (1.00 per
call)
Calls:
elantech_detect/1 (elantech_detect) @0x7ffff6c47498
Type: function definition analyzed
Visibility: externally_visible public
References:
Referring:
Availability: available
First run: 0
Function flags: body icf_merged
Called by:
Calls: fsp_detect/2 (1.00 per call)
Can you please help me Honza?
Thanks,
Martin