aboutsummaryrefslogtreecommitdiffstats
path: root/lib/VMCore/Metadata.cpp
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
commitf563fc35c89b7518baf2eb6580bd72041e39651b (patch)
tree1392cd6933fefb04c4a028eddda88c38defb70b2 /lib/VMCore/Metadata.cpp
parent43b32e0cff08a5bcc20797639acce07dbe2f3dff (diff)
downloadexternal_llvm-f563fc35c89b7518baf2eb6580bd72041e39651b.zip
external_llvm-f563fc35c89b7518baf2eb6580bd72041e39651b.tar.gz
external_llvm-f563fc35c89b7518baf2eb6580bd72041e39651b.tar.bz2
Reserve space for the eventual filling of the vector. This gives a small speedup.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@153949 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/VMCore/Metadata.cpp')
-rw-r--r--lib/VMCore/Metadata.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/VMCore/Metadata.cpp b/lib/VMCore/Metadata.cpp
index e3a08d4..46363ee 100644
--- a/lib/VMCore/Metadata.cpp
+++ b/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() {