[IndVars] Hoist compares made loop-invariant to the preheader. (#241408)
To enable additional unswitching, hoist invariant compares into the
preheader.
Enables additional unswitching in a number of cases end-to-end:
https://github.com/dtcxzyw/llvm-opt-benchmark-nightly/pull/1977
Alternative to requesting another LICM run
(https://github.com/llvm/llvm-project/pull/215899) , just to create the
invariant condition outside the loop, as here we already know it is
invariant and we need to create a new instruction anyways.
See also https://github.com/llvm/llvm-project/pull/238580
PR: https://github.com/llvm/llvm-project/pull/241408