diff options
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 85ea8c5e31..d23547fb36 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -182,8 +182,14 @@ void CodeGenFunction::EmitBlock(llvm::BasicBlock *BB, bool IsFinished) { // If necessary, associate the block with the cleanup stack size. if (!CleanupEntries.empty()) { - BlockScopes[BB] = CleanupEntries.size() - 1; - CleanupEntries.back().Blocks.push_back(BB); + // Check if the basic block has already been inserted. + BlockScopeMap::iterator I = BlockScopes.find(BB); + if (I != BlockScopes.end()) { + assert(I->second == CleanupEntries.size() - 1); + } else { + BlockScopes[BB] = CleanupEntries.size() - 1; + CleanupEntries.back().Blocks.push_back(BB); + } } CurFn->getBasicBlockList().push_back(BB); |