Currently, IsLoopInvariantInst returns true implicitly indicate that all the instruction's operands(virtual registers) are not in the same loop with the instruction itself. So it is always safe to move the instruction since all operands are defined outside of loop.
We want to extend the definition of loop invariant instruction. Even operands of instruction A defined in the same loop with A, A may still be a loop invariant instruction, for example, the operands are rematerializable instructions.
This patch makes safety of moving explicitly in IsLoopInvariantInst, so we can extend the definition of loop invariant instruction without considering the above implicitly indicating.
clang-tidy: warning: invalid case style for function 'IsLoopInvariantInst' [readability-identifier-naming]
not useful