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 | 2d605ac1f511b433408362df5d7dba19d5eac6f1 (patch) | |
tree | c865f6138b75f24c092a991f9b917512a838d175 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 4626285dba87fb675fbef7946b0f74b5ee4555f2 (diff) | |
download | bcm5719-llvm-2d605ac1f511b433408362df5d7dba19d5eac6f1.tar.gz bcm5719-llvm-2d605ac1f511b433408362df5d7dba19d5eac6f1.zip |
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.
llvm-svn: 107676
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 306989f11e2..9375b77360c 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/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; } |