> > so gain is the difference of runtime of integer variant compared to
> > vector vairant and cost are the extra int->see and sse->int conversions
> > needed?
> > 
> > If you scale everything by a BB frequency, you will get a weird
> > behaviour if chain happens to consist only of instructions in BBs with 0
> > frequency (that commonly happens in FDO).
> > 
> > I think you want to look at the chain first and see if it contains a hot
> > instruction. If it does, use performance metrics (ix86_cost and scaling
> > by BB frequencies) if it does not use size metrics (ix86_size_cost and
> > all scales 1)
> 
> There is rtl_ssa::changes_are_worthwhile which solves similar problem.
> Logic there seems OK to me.  It computes unscaled cost in integers and
> weighted cost that is updated only for hot BBs
> 
> After both set of costs are computed, if the weighted cost indicates
> that replacement is worthwhile, it will be done.
> 
> This works well for chains that contains some portions in cold BBs with
> frequency of 0 as well as for those that have everything in cold BBs.

I also realize it would need more work, but what the pass does is quite
close to the job of late combine pass.  Since late combine has all the
substitution logic nicely separated into rtl-ssa framework, converting
STv to rtl-ssa as well will likely make it easier and faster...

Honza

Reply via email to