summaryrefslogtreecommitdiffstats
path: root/llvm
diff options
context:
space:
mode:
authorBill Wendling <isanbard@gmail.com>2012-04-03 10:50:09 +0000
committerBill Wendling <isanbard@gmail.com>2012-04-03 10:50:09 +0000
commitdd91e73409e6bdcb157933ebe55b4626acc584f5 (patch)
treef36d91ab4a23200cfe0e08f33b8f2dcb82ff746b /llvm
parent9270a8875a73cd180efeec8924855694cd302f93 (diff)
downloadbcm5719-llvm-dd91e73409e6bdcb157933ebe55b4626acc584f5.tar.gz
bcm5719-llvm-dd91e73409e6bdcb157933ebe55b4626acc584f5.zip
Reserve space for the eventual filling of the vector. This gives a small speedup.
llvm-svn: 153949
Diffstat (limited to 'llvm')
-rw-r--r--llvm/lib/VMCore/Metadata.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/llvm/lib/VMCore/Metadata.cpp b/llvm/lib/VMCore/Metadata.cpp
index e3a08d4949c..46363eed525 100644
--- a/llvm/lib/VMCore/Metadata.cpp
+++ b/llvm/lib/VMCore/Metadata.cpp
@@ -551,17 +551,16 @@ getAllMetadataOtherThanDebugLocImpl(SmallVectorImpl<std::pair<unsigned,
getContext().pImpl->MetadataStore.count(this) &&
"Shouldn't have called this");
const LLVMContextImpl::MDMapTy &Info =
- getContext().pImpl->MetadataStore.find(this)->second;
+ getContext().pImpl->MetadataStore.find(this)->second;
assert(!Info.empty() && "Shouldn't have called this");
-
+ Result.reserve(Info.size());
Result.append(Info.begin(), Info.end());
-
+
// Sort the resulting array so it is stable.
if (Result.size() > 1)
array_pod_sort(Result.begin(), Result.end());
}
-
/// clearMetadataHashEntries - Clear all hashtable-based metadata from
/// this instruction.
void Instruction::clearMetadataHashEntries() {
OpenPOWER on IntegriCloud