As reported on https://bugs.llvm.org/show_bug.cgi?id=51020, the guard widening loop pass doesn't preserve MemorySSA, so it can no longer be scheduled in the same loop pass manager as LICM. However, the loop-schedule.ll test indicates that this is supposed to work.
Fix this by preserving MemorySSA if available, as this seems to be trivial in this case (we only need to drop the memory access for the guards).
clang-format: please reformat the code