[llvm-commits] [llvm] r153949 - /llvm/trunk/lib/VMCore/Metadata.cpp
Bill Wendling
isanbard at gmail.com
Tue Apr 3 03:50:09 PDT 2012
Author: void
Date: Tue Apr 3 05:50:09 2012
New Revision: 153949
URL: http://llvm.org/viewvc/llvm-project?rev=153949&view=rev
Log:
Reserve space for the eventual filling of the vector. This gives a small speedup.
Modified:
llvm/trunk/lib/VMCore/Metadata.cpp
Modified: llvm/trunk/lib/VMCore/Metadata.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Metadata.cpp?rev=153949&r1=153948&r2=153949&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Metadata.cpp (original)
+++ llvm/trunk/lib/VMCore/Metadata.cpp Tue Apr 3 05:50:09 2012
@@ -551,17 +551,16 @@
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() {
More information about the llvm-commits
mailing list