[llvm] 8d2258f - [memprof] Call llvm::SmallVector::reserve (#93324)
via llvm-commits
llvm-commits at lists.llvm.org
Fri May 24 10:42:49 PDT 2024
Author: Kazu Hirata
Date: 2024-05-24T10:42:46-07:00
New Revision: 8d2258fd3b2a4cde56cc2c679a9ee5b2c966a9e0
URL: https://github.com/llvm/llvm-project/commit/8d2258fd3b2a4cde56cc2c679a9ee5b2c966a9e0
DIFF: https://github.com/llvm/llvm-project/commit/8d2258fd3b2a4cde56cc2c679a9ee5b2c966a9e0.diff
LOG: [memprof] Call llvm::SmallVector::reserve (#93324)
Added:
Modified:
llvm/lib/ProfileData/MemProf.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ProfileData/MemProf.cpp b/llvm/lib/ProfileData/MemProf.cpp
index 5c86c0d9c7bbb..e5608644519db 100644
--- a/llvm/lib/ProfileData/MemProf.cpp
+++ b/llvm/lib/ProfileData/MemProf.cpp
@@ -208,6 +208,7 @@ static IndexedMemProfRecord deserializeV2(const MemProfSchema &Schema,
// Read the meminfo nodes.
const uint64_t NumNodes =
endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
+ Record.AllocSites.reserve(NumNodes);
for (uint64_t I = 0; I < NumNodes; I++) {
IndexedAllocationInfo Node;
Node.CSId = endian::readNext<CallStackId, llvm::endianness::little>(Ptr);
@@ -219,6 +220,7 @@ static IndexedMemProfRecord deserializeV2(const MemProfSchema &Schema,
// Read the callsite information.
const uint64_t NumCtxs =
endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
+ Record.CallSiteIds.reserve(NumCtxs);
for (uint64_t J = 0; J < NumCtxs; J++) {
CallStackId CSId =
endian::readNext<CallStackId, llvm::endianness::little>(Ptr);
More information about the llvm-commits
mailing list