Skip to content

Commit 8d2258f

Browse files
[memprof] Call llvm::SmallVector::reserve (#93324)
1 parent 41c057b commit 8d2258f

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

llvm/lib/ProfileData/MemProf.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,7 @@ static IndexedMemProfRecord deserializeV2(const MemProfSchema &Schema,
208208
// Read the meminfo nodes.
209209
const uint64_t NumNodes =
210210
endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
211+
Record.AllocSites.reserve(NumNodes);
211212
for (uint64_t I = 0; I < NumNodes; I++) {
212213
IndexedAllocationInfo Node;
213214
Node.CSId = endian::readNext<CallStackId, llvm::endianness::little>(Ptr);
@@ -219,6 +220,7 @@ static IndexedMemProfRecord deserializeV2(const MemProfSchema &Schema,
219220
// Read the callsite information.
220221
const uint64_t NumCtxs =
221222
endian::readNext<uint64_t, llvm::endianness::little>(Ptr);
223+
Record.CallSiteIds.reserve(NumCtxs);
222224
for (uint64_t J = 0; J < NumCtxs; J++) {
223225
CallStackId CSId =
224226
endian::readNext<CallStackId, llvm::endianness::little>(Ptr);

0 commit comments

Comments
 (0)