With this patch, test test/Transforms/LoopSimplifyCFG/lcssa.ll hits the assertion
opt: /home/mkazantsev/work/llvm/llvm/lib/Analysis/MemorySSAUpdater.cpp:848: void llvm::MemorySSAUpdater::applyInsertUpdates(llvm::ArrayRef<llvm::cfg::Update<llvm::BasicBlock*> >, llvm::DominatorTree&, const llvm::GraphDiff<llvm::BasicBlock*, false>*): Assertion `DT.dominates(NewIDom, PrevIDom) && "New idom should dominate old idom"' failed.
when we try to apply updates to MSSA. The very same updates have updated DT correctly (it passes verification).
It must be something fishy around how MSSA updater works which I don't understand.