It seems the earlier implementation does not follow the description
in LoopRotationPass.h: It rotates loops even if they are already laid out
correctly. The diff adjusts the behaviour.
Given that the impact of LoopInversionPass is minor, this change won't
yield significant perf differences. Tested on clang-10: there seems to be a
0.1%-0.3% cpu win and a small reduction of branch misses.
Before:
BOLT-INFO: 120 Functions were reordered by LoopInversionPass
After:
BOLT-INFO: 79 Functions were reordered by LoopInversionPass
Could you please re-format this "if" condition back how it was and use "else if" for new condition?