summaryrefslogtreecommitdiff
path: root/lib/Transforms/Scalar/GVN.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-11 08:19:16 +0000
committerChris Lattner <sabre@nondot.org>2011-01-11 08:19:16 +0000
commit3077ca97bdd4de7e8878e2f8308b6f615b60a470 (patch)
treee7ab8b7f18b93e683a7d7baa513e2bb16323115b /lib/Transforms/Scalar/GVN.cpp
parentb6810991a9648a40fe05162d744f42c3c178dba7 (diff)
downloadllvm-3077ca97bdd4de7e8878e2f8308b6f615b60a470.tar.gz
llvm-3077ca97bdd4de7e8878e2f8308b6f615b60a470.tar.bz2
llvm-3077ca97bdd4de7e8878e2f8308b6f615b60a470.tar.xz
update memdep when an instruction is deleted. This code isn't
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
Diffstat (limited to 'lib/Transforms/Scalar/GVN.cpp')
-rw-r--r--lib/Transforms/Scalar/GVN.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/Transforms/Scalar/GVN.cpp b/lib/Transforms/Scalar/GVN.cpp
index a4bd7c1eb4..db6ed3977d 100644
--- a/lib/Transforms/Scalar/GVN.cpp
+++ b/lib/Transforms/Scalar/GVN.cpp
@@ -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;
}