https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65478
Jan Hubicka <hubicka at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Component|tree-optimization |ipa Summary|crafty performance |[5 regression] crafty |regression |performance regression --- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> --- Martin: Looking into it, the parameter 4(ply)=2 and donull=true seems to be used in calls starting the recursion: /* ---------------------------------------------------------- | | | now call Search to produce a value for this move. | | | ---------------------------------------------------------- */ begin_root_nodes=nodes_searched; if (first_move) { value=-ABSearch(-beta,-alpha,ChangeSide(wtm), depth+extensions,2,DO_NULL); if (abort_search) { UnMakeMove(1,current_move[1],wtm); return(alpha); } first_move=0; } else { value=-ABSearch(-alpha-1,-alpha,ChangeSide(wtm), depth+extensions,2,DO_NULL); if (abort_search) { UnMakeMove(1,current_move[1],wtm); return(alpha); } if ((value > alpha) && (value < beta)) { value=-ABSearch(-beta,-alpha,ChangeSide(wtm), depth+extensions,2,DO_NULL); if (abort_search) { UnMakeMove(1,current_move[1],wtm); return(alpha); } } } While it recursively call itself with alternating players and sometimes drops to !DO_NULL. Intuitively, clonning the function specializing for first iteration of recursion is like loop peeling and that is already done (not particularly well) by recursive inlining. I would suggest we may disable/add negative hint for cloning in the case where the specialized function will end up calling unspecialized version of itself with non-cold edge. We also may consider adding bit of negative hints for cases where cloning would turn function called once (by noncold edge) to a function called twice. The same may be done with inliner, but that would even more reduce changes that ipa-split produced split functions will actually get partially inlined. Function is inlined by 4.9: Considering NextMove/2405 with 284 size to be inlined into Search.constprop/4352 in unknown:-1 Estimated badness is -128, frequency 0.69. Badness calculation for Search.constprop/4352 -> NextMove/2405 size growth 273, time 174 inline hints: cross_module array_index -128: guessed profile. frequency 0.694000, benefit 1.771337%, time w/o inlining 621, time w inlining 610 overall growth 266 (current) 266 (original) Accounting size:228.00, time:104.18 on predicate:(op4 <= 62) Accounting size:4.00, time:4.13 on predicate:(op2 changed) && (op4 <= 62) Accounting size:2.00, time:1.03 on predicate:(op2 == 0) && (op4 <= 62) Accounting size:2.00, time:1.03 on predicate:(op2 != 0) && (op4 <= 62) I am marking it as a regression thus and changing component to IPA.