Skip to content

Commit 711eb40

Browse files
authored
min
1 parent 1789f85 commit 711eb40

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/ProfileData/SampleProf.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "llvm/Support/LEB128.h"
2424
#include "llvm/Support/raw_ostream.h"
2525
#include <algorithm>
26+
#include <cstdint>
2627
#include <string>
2728
#include <system_error>
2829

@@ -400,8 +401,8 @@ LLVM_DUMP_METHOD void FunctionSamples::dump() const { print(dbgs(), 0); }
400401
std::error_code ProfileSymbolList::read(const uint8_t *Data,
401402
uint64_t ListSize) {
402403
// Scan forward to see how many elements we expect.
403-
uint64_t ExpectedCount = std::count(Data, Data + ListSize, 0);
404-
reserve(ExpectedCount);
404+
reserve(std::min<uint64_t>(ProfileSymbolListCutOff,
405+
std::count(Data, Data + ListSize, 0)));
405406

406407
const char *ListStart = reinterpret_cast<const char *>(Data);
407408
uint64_t Size = 0;

0 commit comments

Comments
 (0)