diff options
author | John McCall <rjmccall@apple.com> | 2010-07-06 17:35:03 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2010-07-06 17:35:03 +0000 |
commit | 66d80a9c99ef781f0fd56dfcd060e30d4d673c93 (patch) | |
tree | 3b05e064de5fcd053940c5cce07a19dd2067cf93 /lib/CodeGen/CodeGenFunction.cpp | |
parent | 7d6228fc77baf405c6554bb47904fc197e33b488 (diff) |
When destroying a cleanup, kill any references to instructions in the entry
block before deleting it. Fixes PR7575.
This really just a short-term fix before implementing lazy cleanups.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@107676 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | lib/CodeGen/CodeGenFunction.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 306989f11e..9375b77360 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -688,6 +688,12 @@ static void DestroyCleanup(CodeGenFunction &CGF, llvm::BranchInst::Create(CGF.getUnreachableBlock(), Exit); assert(!Entry->getParent() && "cleanup entry already positioned?"); + // We can't just delete the entry; we have to kill any references to + // its instructions in other blocks. + for (llvm::BasicBlock::iterator I = Entry->begin(), E = Entry->end(); + I != E; ++I) + if (!I->use_empty()) + I->replaceAllUsesWith(llvm::UndefValue::get(I->getType())); delete Entry; } |