From ad9d00e371f4f4e63a540f4e4c501797db2a43de Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Sun, 8 Feb 2009 22:45:15 +0000 Subject: [PATCH] Always check if we can remove branch fixups, even if the cleanup stack is empty. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64099 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenFunction.cpp | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/lib/CodeGen/CodeGenFunction.cpp b/lib/CodeGen/CodeGenFunction.cpp index 4ae8708054..09316e974f 100644 --- a/lib/CodeGen/CodeGenFunction.cpp +++ b/lib/CodeGen/CodeGenFunction.cpp @@ -545,26 +545,24 @@ CodeGenFunction::CleanupBlockInfo CodeGenFunction::PopCleanupBlock() CleanupEntries.pop_back(); - if (!CleanupEntries.empty()) { - // Check if any branch fixups pointed to the scope we just popped. If so, - // we can remove them. - for (size_t i = 0, e = BranchFixups.size(); i != e; ++i) { - llvm::BasicBlock *Dest = BranchFixups[i]->getSuccessor(0); - BlockScopeMap::iterator I = BlockScopes.find(Dest); + // Check if any branch fixups pointed to the scope we just popped. If so, + // we can remove them. + for (size_t i = 0, e = BranchFixups.size(); i != e; ++i) { + llvm::BasicBlock *Dest = BranchFixups[i]->getSuccessor(0); + BlockScopeMap::iterator I = BlockScopes.find(Dest); - if (I == BlockScopes.end()) - continue; + if (I == BlockScopes.end()) + continue; - assert(I->second <= CleanupEntries.size() && "Invalid branch fixup!"); + assert(I->second <= CleanupEntries.size() && "Invalid branch fixup!"); - if (I->second == CleanupEntries.size()) { - // We don't need to do this branch fixup. - BranchFixups[i] = BranchFixups.back(); - BranchFixups.pop_back(); - i--; - e--; - continue; - } + if (I->second == CleanupEntries.size()) { + // We don't need to do this branch fixup. + BranchFixups[i] = BranchFixups.back(); + BranchFixups.pop_back(); + i--; + e--; + continue; } } -- 2.40.0