DSE: Poking holes into a SetVector is expensive, avoid it if possible.
authorBenjamin Kramer <benny.kra@googlemail.com>
Sun, 9 Sep 2012 16:44:05 +0000 (16:44 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Sun, 9 Sep 2012 16:44:05 +0000 (16:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163480 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/DeadStoreElimination.cpp

index 25a1dd770afcb6e8a18dce2cf9d954ed682bcf78..1ff4329c8467d59427f2c4fe92a6fe660ed71f08 100644 (file)
@@ -775,15 +775,15 @@ bool DSE::handleEndBlock(BasicBlock &BB) {
           LiveAllocas.push_back(*I);
       }
 
-      for (SmallVector<Value*, 8>::iterator I = LiveAllocas.begin(),
-           E = LiveAllocas.end(); I != E; ++I)
-        DeadStackObjects.remove(*I);
-
       // If all of the allocas were clobbered by the call then we're not going
       // to find anything else to process.
-      if (DeadStackObjects.empty())
+      if (DeadStackObjects.size() == LiveAllocas.size())
         break;
 
+      for (SmallVector<Value*, 8>::iterator I = LiveAllocas.begin(),
+           E = LiveAllocas.end(); I != E; ++I)
+        DeadStackObjects.remove(*I);
+
       continue;
     }