diff --git a/lib/Transforms/Scalar/DeadStoreElimination.cpp b/lib/Transforms/Scalar/DeadStoreElimination.cpp index 25a1dd770af..1ff4329c846 100644 --- a/lib/Transforms/Scalar/DeadStoreElimination.cpp +++ b/lib/Transforms/Scalar/DeadStoreElimination.cpp @@ -775,15 +775,15 @@ bool DSE::handleEndBlock(BasicBlock &BB) { LiveAllocas.push_back(*I); } + // If all of the allocas were clobbered by the call then we're not going + // to find anything else to process. + if (DeadStackObjects.size() == LiveAllocas.size()) + break; + for (SmallVector::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()) - break; - continue; }