Specifically:
- Calculate the loop pre-header once at the start of HoistOutOfLoop, so:
- We don't DFS-walk the MachineDomTree if we aren't going to do anything
- Don't call getCurPreheader for each Scope
- Don't needlessly use a do-while loop
- Use early exit for Scopes.size() == 0
No functional changes intended.