update memdep when an instruction is deleted. This code isn't
authorChris Lattner <sabre@nondot.org>
Tue, 11 Jan 2011 08:19:16 +0000 (08:19 +0000)
committerChris Lattner <sabre@nondot.org>
Tue, 11 Jan 2011 08:19:16 +0000 (08:19 +0000)
actually reached in the testcase in PR8954, but it's safe and good
practice.

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

lib/Transforms/Scalar/GVN.cpp

index a4bd7c1eb4234d4a7d93ac5f2bb011b520b914ce..db6ed3977d16480c58b7489e1dddc81b04c1255c 100644 (file)
@@ -1383,8 +1383,11 @@ bool GVN::processNonLocalLoad(LoadInst *LI,
   }
 
   if (!CanDoPRE) {
-    while (!NewInsts.empty())
-      NewInsts.pop_back_val()->eraseFromParent();
+    while (!NewInsts.empty()) {
+      Instruction *I = NewInsts.pop_back_val();
+      if (MD) MD->removeInstruction(I);
+      I->eraseFromParent();
+    }
     return false;
   }