Split out of https://reviews.llvm.org/D71990. Minor stuff like renaming and introduction of divideNearest utility.
Can we agree on BackedgeTakenWeight and LatchExitWeight? They directly correspond to "the number of times the backedge was taken" and "the number of times we exited the loop" documented above, and the comment removed below.
(Above early exit can precede the swap, but agree it's better to first set the variables to their correct meaning.)
Original "// Divide the count ..." comment removed deliberately?