Hi,

On Wed, Sep 23 2020, Jan Hubicka wrote:
>> There's patch that does that.
>> 
>> Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
>> 
>> Ready to be installed?
>> Thanks,
>> Martin
>
>> From ff5f78110684ed9aedde15d19e856b3acf649971 Mon Sep 17 00:00:00 2001
>> From: Martin Liska <mli...@suse.cz>
>> Date: Wed, 23 Sep 2020 15:10:43 +0200
>> Subject: [PATCH] Port IPA CP time and size to sreal
>> 
>> gcc/ChangeLog:
>> 
>>      * ipa-cp.c (ipcp_lattice::print): Print sreal values
>>      with to_double.
>>      (incorporate_penalties): Change type to sreal.
>>      (good_cloning_opportunity_p): Change args to sreal.
>>      (get_max_overall_size): Work in sreal type.
>>      (estimate_local_effects): Likewise.
>>      (safe_add): Remove.
>>      (value_topo_info::propagate_effects): Work in sreal type.
>>      (ipcp_propagate_stage): Print sreal numbers.
>>      (decide_about_value): Work in sreal type.
>> ---
>>  gcc/ipa-cp.c | 128 ++++++++++++++++++++++++---------------------------
>>  1 file changed, 59 insertions(+), 69 deletions(-)
>> 
>> diff --git a/gcc/ipa-cp.c b/gcc/ipa-cp.c
>> index b3e7d41ea10..9a79b5862f8 100644
>> --- a/gcc/ipa-cp.c
>> +++ b/gcc/ipa-cp.c
>> @@ -157,10 +157,10 @@ class ipcp_value_base
>>  public:
>>    /* Time benefit and size cost that specializing the function for this 
>> value
>>       would bring about in this function alone.  */
>> -  int local_time_benefit, local_size_cost;
>> +  sreal local_time_benefit, local_size_cost;
>>    /* Time benefit and size cost that specializing the function for this 
>> value
>>       can bring about in it's callees (transitively).  */
>> -  int prop_time_benefit, prop_size_cost;
>> +  sreal prop_time_benefit, prop_size_cost;
>
> Time calculaitons can get out of hand, while size calculations still
> corresponds to actual program instructions, so int should be enough
> (I would start using 64bit ints for whole program statistics, like
> overall size below because eventaully we may hit that).

Please note that in PR 96806 we have seen size overflow int when the
value of param ipa-cp-max-recursive-depth is huge.  So you either need
to keep using safe_add for it or make it a 64 bit int everywhere (and
hope that other things break earlier if someone wants to use a value of
the param big enough to overflow even 64 bits - or that people testing
GCC with strange parameters do not test values this extreme :-).

Martin

Reply via email to