[llvm] 6d44b3c - [NFCI][DomTreeUpdater] applyUpdates(): reserve space for updates first

Roman Lebedev via llvm-commits llvm-commits at lists.llvm.org
Sun Apr 11 13:56:44 PDT 2021


Author: Roman Lebedev
Date: 2021-04-11T23:56:22+03:00
New Revision: 6d44b3c56d4a80b16f144a52bc841111c0b4d2c2

URL: https://github.com/llvm/llvm-project/commit/6d44b3c56d4a80b16f144a52bc841111c0b4d2c2
DIFF: https://github.com/llvm/llvm-project/commit/6d44b3c56d4a80b16f144a52bc841111c0b4d2c2.diff

LOG: [NFCI][DomTreeUpdater] applyUpdates(): reserve space for updates first

While, indeed, we may end up pushing less updates that we'd reserve space
for, self-dominating updates aren't often enough for that to matter.
But this should matter for normal updates.

Added: 
    

Modified: 
    llvm/lib/Analysis/DomTreeUpdater.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Analysis/DomTreeUpdater.cpp b/llvm/lib/Analysis/DomTreeUpdater.cpp
index 8ac7d9d4efd06..6e299263e66da 100644
--- a/llvm/lib/Analysis/DomTreeUpdater.cpp
+++ b/llvm/lib/Analysis/DomTreeUpdater.cpp
@@ -232,6 +232,7 @@ void DomTreeUpdater::applyUpdates(ArrayRef<DominatorTree::UpdateType> Updates) {
     return;
 
   if (Strategy == UpdateStrategy::Lazy) {
+    PendUpdates.reserve(PendUpdates.size() + Updates.size());
     for (const auto &U : Updates)
       if (!isSelfDominance(U))
         PendUpdates.push_back(U);


        


More information about the llvm-commits mailing list