From: Duncan Sands Date: Fri, 8 Jun 2007 08:59:11 +0000 (+0000) Subject: Use more realistically sized vectors. Reserve capacity if we know in advance X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6cc7608213cc69ddeb0a25df360bbbe13a5c069d;p=oota-llvm.git Use more realistically sized vectors. Reserve capacity if we know in advance how much will be used. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@37515 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/CodeGen/DwarfWriter.cpp b/lib/CodeGen/DwarfWriter.cpp index 850f25b2bf8..6bfbacd7136 100644 --- a/lib/CodeGen/DwarfWriter.cpp +++ b/lib/CodeGen/DwarfWriter.cpp @@ -2973,16 +2973,19 @@ private: // Sort the landing pads in order of their type ids. This is used to fold // duplicate actions. - SmallVector LandingPads(PadInfos.size(), NULL); + SmallVector LandingPads; + + LandingPads.reserve(PadInfos.size()); for (unsigned i = 0, N = PadInfos.size(); i != N; ++i) - LandingPads[i] = &PadInfos[i]; + LandingPads.push_back(&PadInfos[i]); std::sort(LandingPads.begin(), LandingPads.end(), PadLT); // Gather first action index for each landing pad site. - SmallVector FirstActions; + SmallVector FirstActions; + FirstActions.reserve(PadInfos.size()); // The actions table. - SmallVector Actions; + SmallVector Actions; // Compute sizes for exception table. unsigned SizeSites = 0;