Refactor Threshold computation. NFC.
Refactor Threshold computation. NFC.

This is part of changes reviewed in http://reviews.llvm.org/D17584.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@265852 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 8a0abe782bdb50631b40e9ce200743c5b6c2de6a)

apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm,apple/swift-llvm