[Support] Add mulDivNearest and use it to scale profile counts (NFC) (#235916)
BlockFrequencyInfoImplBase::getProfileCountFromFreq and MergeFunctions'
scaleToBlockCount both compute X * Y / Z rounded half up with a 128-bit
APInt, saturating to UINT64_MAX. Move this into mulDivNearest in
MathExtras, next to divideNearest, so that other code scaling profile
counts can share it.
mulDivNearest only uses APInt when the product does not fit in 64 bits,
which avoids allocating a 128-bit APInt in the common case.
scaleToBlockCount is removed and its only caller calls mulDivNearest
directly, guarding only against a zero total weight, since mulDivNearest
already returns 0 for a zero weight or block count. The assert on the
width of the result is dropped: the result now saturates, and a weight
never exceeds the total weight, which is the sum of the weights.
Possible non-NFC followup work: setBlockFreqAndScale and scaleProfData
(which round down and cap at MAXINT32 instead of 64).