diff options
author | Anders Carlsson <andersca@mac.com> | 2009-02-10 22:50:24 +0000 |
---|---|---|
committer | Anders Carlsson <andersca@mac.com> | 2009-02-10 22:50:24 +0000 |
commit | 22ab8d86ec613ace6602b6de11fa9ccc08580f6b (patch) | |
tree | e104ba5309f0e063de17d5f7c36829903e15411c /lib/CodeGen/CGStmt.cpp | |
parent | 3afdfd70616b5ba569dc4e78f41063d35b127464 (diff) |
Handle the case where EmitBlock might be called multiple times for the same block. Fixes PR3536.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64252 91177308-0d34-0410-b5e6-96231b3b80d8
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); |