When we delete instructions from the loop, make sure to remove them from the
authorChris Lattner <sabre@nondot.org>
Thu, 18 Dec 2003 08:12:32 +0000 (08:12 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 18 Dec 2003 08:12:32 +0000 (08:12 +0000)
AliasSetTracker as well.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@10507 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/LICM.cpp

index 6046f02563ec82971ddea443d103ca185f604b11..19162292ee18f9bc5337eb59758be35e835ccb78 100644 (file)
@@ -387,6 +387,7 @@ void LICM::sink(Instruction &I) {
   if (ExitBlocks.size() == 1) {
     if (!isExitBlockDominatedByBlockInLoop(ExitBlocks[0], I.getParent())) {
       // Instruction is not used, just delete it.
+      CurAST->remove(&I);
       I.getParent()->getInstList().erase(&I);
     } else {
       // Move the instruction to the start of the exit block, after any PHI
@@ -399,6 +400,7 @@ void LICM::sink(Instruction &I) {
     }
   } else if (ExitBlocks.size() == 0) {
     // The instruction is actually dead if there ARE NO exit blocks.
+    CurAST->remove(&I);
     I.getParent()->getInstList().erase(&I);
   } else {
     // Otherwise, if we have multiple exits, use the PromoteMem2Reg function to