diff options
author | Chris Lattner <sabre@nondot.org> | 2011-01-11 08:19:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-01-11 08:19:16 +0000 |
commit | 193ce7c4d16d5b79cb00936ec4aef10675b07976 (patch) | |
tree | 698029751dc121d7a93fd60ca649611e42943963 /llvm | |
parent | e2523b287cc52e9908e615d06ae249caa9b3e416 (diff) | |
download | bcm5719-llvm-193ce7c4d16d5b79cb00936ec4aef10675b07976.tar.gz bcm5719-llvm-193ce7c4d16d5b79cb00936ec4aef10675b07976.zip |
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.
llvm-svn: 123224
Diffstat (limited to 'llvm')
-rw-r--r-- | llvm/lib/Transforms/Scalar/GVN.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/llvm/lib/Transforms/Scalar/GVN.cpp b/llvm/lib/Transforms/Scalar/GVN.cpp index a4bd7c1eb42..db6ed3977d1 100644 --- a/llvm/lib/Transforms/Scalar/GVN.cpp +++ b/llvm/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; } |