Need to get conclusion that whether the loop can be converted to a hardware loop in some previous pass like LSR.
Move some code to structure HardwareLoopInfo, so that other pass can use it. This is a NFC patch.
Whole picture can be found in https://reviews.llvm.org/D63477