From: Owen Anderson Date: Fri, 22 Jun 2007 00:43:22 +0000 (+0000) Subject: Reserve space in vectors before topologically sorting into them. This improves the... X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=e8138ffeaf9722cbd370c970c6d735f3a6a0f884;p=oota-llvm.git Reserve space in vectors before topologically sorting into them. This improves the time to optimize 403.gcc from 28s to 23.5s. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37699 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/GVNPRE.cpp b/lib/Transforms/Scalar/GVNPRE.cpp index 078d8954847..045ca5c4f82 100644 --- a/lib/Transforms/Scalar/GVNPRE.cpp +++ b/lib/Transforms/Scalar/GVNPRE.cpp @@ -585,6 +585,7 @@ bool GVNPRE::dependsOnInvoke(Value* V) { /// above) void GVNPRE::clean(SmallPtrSet& set) { std::vector worklist; + worklist.reserve(set.size()); topo_sort(set, worklist); for (unsigned i = 0; i < worklist.size(); ++i) { @@ -1173,6 +1174,7 @@ bool GVNPRE::insertion(Function& F) { // If there is more than one predecessor... if (pred_begin(BB) != pred_end(BB) && ++pred_begin(BB) != pred_end(BB)) { std::vector workList; + workList.reserve(anticIn.size()); topo_sort(anticIn, workList); DOUT << "Merge Block: " << BB->getName() << "\n";