The implementation of the new function is borrowed from MachineBranchProbabilityInfo::getSumForBlock. The type of weight list is a template parameter so that we can pass weights in either uint32_t or uint64_t.
This function can be useful when we need to normalize a list of edge weights.
Why not doing normalization unconditionally to avoid precision loss introduced by incremental update (for small weights)?