[cfe-commits] r64096 - /cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
Anders Carlsson
andersca at mac.com
Sun Feb 8 14:13:37 PST 2009
Author: andersca
Date: Sun Feb 8 16:13:37 2009
New Revision: 64096
URL: http://llvm.org/viewvc/llvm-project?rev=64096&view=rev
Log:
Misc fixes to the cleanup stack code.
Modified:
cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
Modified: cfe/trunk/lib/CodeGen/CodeGenFunction.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenFunction.cpp?rev=64096&r1=64095&r2=64096&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenFunction.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenFunction.cpp Sun Feb 8 16:13:37 2009
@@ -586,7 +586,11 @@
llvm::SwitchInst *SI = Builder.CreateSwitch(DestCode, EndBlock,
BranchFixups.size());
- Builder.SetInsertPoint(CurBB);
+ // Restore the current basic block (if any)
+ if (CurBB)
+ Builder.SetInsertPoint(CurBB);
+ else
+ Builder.ClearInsertionPoint();
for (size_t i = 0, e = BranchFixups.size(); i != e; ++i) {
llvm::BranchInst *BI = BranchFixups[i];
@@ -658,8 +662,13 @@
void CodeGenFunction::EmitBranchThroughCleanup(llvm::BasicBlock *Dest)
{
+ if (!HaveInsertPoint())
+ return;
+
llvm::BranchInst* BI = Builder.CreateBr(Dest);
+ Builder.ClearInsertionPoint();
+
// The stack is empty, no need to do any cleanup.
if (CleanupEntries.empty())
return;
More information about the cfe-commits
mailing list