[PATCH] D57176: [MemorySSA +LICM CFHoist] Solve PR40317.

Alina Sbirlea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 24 11:23:18 PST 2019


asbirlea created this revision.
asbirlea added a reviewer: jnspaulsson.
Herald added subscribers: george.burgess.iv, Prazek, jlebar, sanjoy.

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.


Repository:
  rL LLVM

https://reviews.llvm.org/D57176

Files:
  lib/Transforms/Scalar/LICM.cpp


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<MemoryUseOrDef>(
+              MSSAU->getMemorySSA()->getMemoryAccess(I)))
+            MSSAU->moveToPlace(OldMemAcc, HoistPoint->getParent(), MemorySSA::End);
         HoistPoint = I;
         Changed = true;
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57176.183354.patch
Type: text/x-patch
Size: 671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190124/1fd65371/attachment.bin>


More information about the llvm-commits mailing list