Index: lib/Transforms/Scalar/LICM.cpp =================================================================== --- lib/Transforms/Scalar/LICM.cpp +++ lib/Transforms/Scalar/LICM.cpp @@ -993,6 +993,10 @@ << HoistPoint->getParent()->getName() << ": " << *I << "\n"); moveInstructionBefore(*I, *HoistPoint, *SafetyInfo); + if (MSSAU) + if (MemoryUseOrDef *OldMemAcc = cast_or_null( + MSSAU->getMemorySSA()->getMemoryAccess(I))) + MSSAU->moveToPlace(OldMemAcc, HoistPoint->getParent(), MemorySSA::End); HoistPoint = I; Changed = true; }