https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81133

--- Comment #7 from Martin Liška <marxin at gcc dot gnu.org> ---
I've got it what's responsible. When the edge_badness is called for the first
time, we call compute_uninlined_call_time where:

(gdb) p edge->count.to_gcov_type ()
$25 = 194

Then various clones of the caller (app_disable) are created:

#0  profile_count::operator-= (other=..., this=0x2aaab9c1d270) at
../../gcc/profile-count.h:683
#1  cgraph_edge::clone (this=this@entry=0x2aaab9c1d270,
n=n@entry=0x2aaab8ebee60, call_stmt=<optimized out>, stmt_uid=3, num=...,
den=..., freq_scale=<optimized out>, update_original=true) at
../../gcc/cgraphclones.c:147
#2  0x00000000006a20fc in cgraph_node::create_clone (this=0x2aaab9c038a0,
new_decl=<optimized out>, prof_count=..., freq=freq@entry=94,
update_original=<optimized out>, redirect_callers=...,
redirect_callers@entry=..., call_duplication_hook=<optimized out>, 
    new_inlined_to=<optimized out>, args_to_skip=<optimized out>,
suffix=<optimized out>) at ../../gcc/cgraphclones.c:492
#3  0x000000000127a3ff in clone_inlined_nodes (e=e@entry=0x2aaab9c266e8,
duplicate=duplicate@entry=true, update_original=update_original@entry=true,
overall_size=overall_size@entry=0x1f5c3a0 <_ZL12overall_size>, freq_scale=94)
at ../../gcc/ipa-inline-transform.c:235
#4  0x000000000127ae61 in inline_call (e=0x2aaab9c266e8,
update_original=<optimized out>, new_edges=<optimized out>,
overall_size=<optimized out>, update_overall_summary=<optimized out>,
callee_removed=<optimized out>) at ../../gcc/ipa-inline-transform.c:462

where counter changes:
Old value = 194
New value = 91

note that in #4 it's shown that callee is app_disable
(gdb) p e->caller->name()
$26 = 0x2aaaae4acef0 "final_scan_insn"
(gdb) p e->callee->name()
$27 = 0x2aaaae6aa1b0 "app_disable"

This repeats various time and we end up eventually with the counter == 0. Then
compute_uninlined_call_time
returns 0.09765625 instead of 2.8684735298156738e-07.

Reply via email to