Have no a complete idea for new cost model, but there are something we can try: o. adjust estimated profile for recursive function so that we can get a higher threshold. o. introduce a strength level for ipa-cp-clone, by default, it is same as current configuration, and with larger number, ipa-cp works more aggressively. o. integrate frequency information to computation of prop_time_benefit.
Feng ________________________________________ From: Jan Hubicka <hubi...@ucw.cz> Sent: Wednesday, November 27, 2019 10:27 PM To: Feng Xue OS Cc: Martin Jambor; Richard Biener; luoxhu; gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Support multi-versioning on self-recursive function (ipa/92133) > 2019-11-15 Feng Xue <f...@os.amperecomputing.com> > > PR ipa/92133 > * doc/invoke.texi (ipa-cp-max-recursive-depth): Document new option. > (ipa-cp-min-recursive-probability): Likewise. > * params.opt (ipa-cp-max-recursive-depth): New. > (ipa-cp-min-recursive-probability): Likewise. > * ipa-cp.c (ipcp_lattice<valtype>::add_value): Add two new parameters > val_p and unlimited. > (self_recursively_generated_p): New function. > (get_val_across_arith_op): Likewise. > (propagate_vals_across_arith_jfunc): Add constant propagation for > self-recursive function. > (incorporate_penalties): Do not penalize pure self-recursive function. > (good_cloning_opportunity_p): Dump node_is_self_scc flag. > (propagate_constants_topo): Set node_is_self_scc flag for cgraph node. > (get_info_about_necessary_edges): Relax hotness check for edge to > self-recursive function. > * ipa-prop.h (ipa_node_params): Add new field node_is_self_scc. OK, thanks! do you have some plans on the better cost model for the recursive cloning? Also it would be nice to have this info available in recursive inliner and give it a higher priority when inlining is going to turn previously recrusive call into non-recursive. Honza