> > > > #define REG_FREQ_FROM_BB(bb) ((optimize_function_for_size_p (cfun)      
> > > >       \
> > > >                               || !cfun->cfg->count_max.initialized_p 
> > > > ())     \
> > > >                              ? REG_FREQ_MAX                             
> > > >      \
> > > >                              : ((bb)->count.to_frequency (cfun)         
> > > >      \
> > > >                                * REG_FREQ_MAX / BB_FREQ_MAX)            
> > > >      \
> > > >                              ? ((bb)->count.to_frequency (cfun)         
> > > >      \
> > > >                                 * REG_FREQ_MAX / BB_FREQ_MAX)           
> > > >      \
> > > >                              : 1)
> > > >
> > > > 1000 is the default.  If it isn't 1000, it isn't the default.  I only 
> > > > want
> > > > to get a more reasonable default scale, instead of 1000.   Lower
> > > > scale will fail the PR rtl-optimization/111673 test on powerpc64.
> > >
> > > I see.  Why not adjust the above macro then?  That would be a bit more 
> > > obvious.  Like use MAX/2 or so?
> >
> > commit 3b9b8d6cfdf59337f4b7ce10ce92a98044b2657b
> > Author: Surya Kumari Jangala <jskum...@linux.ibm.com>
> > Date:   Tue Jun 25 08:37:49 2024 -0500
> >
> >     ira: Scale save/restore costs of callee save registers with block 
> > frequency
> >
> > uses REG_FREQ_FROM_BB as the cost scale.  I don't know if it is a misuse.
> > I don't want to change REG_FREQ_FROM_BB since it is used in other places,
> > not as a cost scale.  Maybe the above commit should be reverted and we add
> > a target hook for callee-saved register cost scale.  Each target can choose
> > a proper cost scale, install of increasing the cost by 1000x for everyone.
> 
> I believe testing cfun->cfg->count_max.initialized_p () is a bit odd at least,
> as it doesn't seem to be used.  The comment talks about profile feedback,

It is used by count.to_frequency, which basically computes count/max_count * 
REG_FREQ_MAX.
It aborts if max_count is uninitialized rather than returning arbitrary
value...

Honza

Reply via email to