Reserve space for the eventual filling of the vector. This gives a small speedup.
llvm-svn: 153949
This commit is contained in:
parent
9270a8875a
commit
dd91e73409
|
@ -551,9 +551,9 @@ getAllMetadataOtherThanDebugLocImpl(SmallVectorImpl<std::pair<unsigned,
|
||||||
getContext().pImpl->MetadataStore.count(this) &&
|
getContext().pImpl->MetadataStore.count(this) &&
|
||||||
"Shouldn't have called this");
|
"Shouldn't have called this");
|
||||||
const LLVMContextImpl::MDMapTy &Info =
|
const LLVMContextImpl::MDMapTy &Info =
|
||||||
getContext().pImpl->MetadataStore.find(this)->second;
|
getContext().pImpl->MetadataStore.find(this)->second;
|
||||||
assert(!Info.empty() && "Shouldn't have called this");
|
assert(!Info.empty() && "Shouldn't have called this");
|
||||||
|
Result.reserve(Info.size());
|
||||||
Result.append(Info.begin(), Info.end());
|
Result.append(Info.begin(), Info.end());
|
||||||
|
|
||||||
// Sort the resulting array so it is stable.
|
// Sort the resulting array so it is stable.
|
||||||
|
@ -561,7 +561,6 @@ getAllMetadataOtherThanDebugLocImpl(SmallVectorImpl<std::pair<unsigned,
|
||||||
array_pod_sort(Result.begin(), Result.end());
|
array_pod_sort(Result.begin(), Result.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// clearMetadataHashEntries - Clear all hashtable-based metadata from
|
/// clearMetadataHashEntries - Clear all hashtable-based metadata from
|
||||||
/// this instruction.
|
/// this instruction.
|
||||||
void Instruction::clearMetadataHashEntries() {
|
void Instruction::clearMetadataHashEntries() {
|
||||||
|
|
Loading…
Reference in New Issue