Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions llvm/include/llvm/ProfileData/SampleProf.h
Original file line number Diff line number Diff line change
Expand Up @@ -1658,6 +1658,7 @@ class ProfileSymbolList {
}

unsigned size() { return Syms.size(); }
void reserve(size_t Size) { Syms.reserve(Size); }

void setToCompress(bool TC) { ToCompress = TC; }
bool toCompress() { return ToCompress; }
Expand Down
6 changes: 6 additions & 0 deletions llvm/lib/ProfileData/SampleProf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/LEB128.h"
#include "llvm/Support/raw_ostream.h"
#include <algorithm>
#include <cstdint>
#include <string>
#include <system_error>

Expand Down Expand Up @@ -398,6 +400,10 @@ LLVM_DUMP_METHOD void FunctionSamples::dump() const { print(dbgs(), 0); }

std::error_code ProfileSymbolList::read(const uint8_t *Data,
uint64_t ListSize) {
// Scan forward to see how many elements we expect.
reserve(std::min<uint64_t>(ProfileSymbolListCutOff,
std::count(Data, Data + ListSize, 0)));

const char *ListStart = reinterpret_cast<const char *>(Data);
uint64_t Size = 0;
uint64_t StrNum = 0;
Expand Down