From 52f6e2a173c80d31ff94b208dda72c247a02f56b Mon Sep 17 00:00:00 2001 From: Alina Sbirlea Date: Thu, 24 Jan 2019 19:48:35 +0000 Subject: [MemorySSA +LICM CFHoist] Solve PR40317. Summary: MemorySSA needs updating each time an instruction is moved. LICM and control flow hoisting re-hoists instructions, thus needing another update when re-moving those instructions. Pending cleanup: the MSSA update is duplicated, should be moved inside moveInstructionBefore. Reviewers: jnspaulsson Subscribers: sanjoy, jlebar, Prazek, george.burgess.iv, llvm-commits Differential Revision: https://reviews.llvm.org/D57176 llvm-svn: 352092 --- llvm/lib/Transforms/Scalar/LICM.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'llvm/lib/Transforms') diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 391a2bd1de5..09e36261287 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -867,6 +867,11 @@ bool llvm::hoistRegion(DomTreeNode *N, AliasAnalysis *AA, LoopInfo *LI, << 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; } -- cgit v1.2.3