> Hi,.
> 
> this patch converts the variables that hold time benefits and
> frequencies in IPA-CP from plain integers to sreals, avoiding the need
> to cap them to avoid overflows and also fixing a potential underflows.
> 
> Size costs corresponding to individual constants are left as ints so
> that they do not take up too much space.  Care must be taken that
> adding it up does not overflow, especially in the case of
> prop_size_cost, because in cases of extremely long chains of lattice
> dependencies it can overflow (e.g. in testsuite/gcc.dg/ipa/pr50744.c).
> The overall size is already tracked in long ints.
> 
> Bootstrapped, LTO-bootstrapped and tested on x86_64-linux, OK for trunk?
> 
> Thanks,
> 
> Martin
> 
> 
> gcc/ChangeLog:
> 
> 2020-11-11  Martin Jambor  <mjam...@suse.cz>
> 
>       * ipa-cp.c (class ipcp_value_base): Change the type of
>       local_time_benefit and prop_time_benefit to sreal.  Adjust the
>       constructor initializer.
>       (ipcp_lattice::print): Dump sreals.
>       (struct caller_statistics): Change the type of freq_sum to sreal.
>       (gather_caller_stats): Work with sreal freq_sum.
>       (incorporate_penalties): Work with sreal evaluation.
>       (good_cloning_opportunity_p): Adjusted for sreal sreal time_benefit
>       and freq_sum.  Bail out if size_cost is INT_MAX.
>       (perform_estimation_of_a_value): Work with sreal time_benefit.  Avoid
>       unnecessary capping.
>       (estimate_local_effects): Pass sreal time benefit to
>       good_cloning_opportunity_p without capping it.  Adjust dumping.
>       (safe_add): If there can be overflow, return INT_MAX.
>       (propagate_effects): Work with sreal times.
>       (get_info_about_necessary_edges): Work with sreal frequencies.
>       (decide_about_value): Likewise and with sreal time benefits.

OK, thanks!
It is bit odd that we work hard enough to overflow sizes, but I guess it
is just an extreme case.  Definitly capping there makes sense since we
do not want such large duplication.

Honza

Reply via email to