While loop rotation updates the branch_weights correctly for the most part there were some branches missing runtime unroll. This adds code to the loop rotation transformation to ensure that the computed block execution counts for the loop bodies are the same before and after the transformation.
Invariants and heuristics are explained in the comment in the new updateBranchWeights() function.
nit: HasConditionalPreHeader.