]> granicus.if.org Git - clang/commitdiff
Always check if we can remove branch fixups, even if the cleanup stack is empty.
authorAnders Carlsson <andersca@mac.com>
Sun, 8 Feb 2009 22:45:15 +0000 (22:45 +0000)
committerAnders Carlsson <andersca@mac.com>
Sun, 8 Feb 2009 22:45:15 +0000 (22:45 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64099 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenFunction.cpp

index 4ae87080546089c7b4a15dcee42e4dc8ec3bf74f..09316e974f4a0977dce23661f2047c3aaa5f4a24 100644 (file)
@@ -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;
     }
   }