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
4 changes: 2 additions & 2 deletions bolt/lib/Rewrite/PseudoProbeRewriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,8 @@ void PseudoProbeRewriter::parsePseudoProbe(bool ProfiledOnly) {

StringRef Contents = PseudoProbeDescSection->getContents();
if (!ProbeDecoder.buildGUID2FuncDescMap(
reinterpret_cast<const uint8_t *>(Contents.data()),
Contents.size())) {
reinterpret_cast<const uint8_t *>(Contents.data()), Contents.size(),
/*IsMMapped*/ true)) {
errs() << "BOLT-WARNING: fail in building GUID2FuncDescMap\n";
return;
}
Expand Down
5 changes: 4 additions & 1 deletion llvm/include/llvm/MC/MCPseudoProbe.h
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,10 @@ class MCPseudoProbeDecoder {
using Uint64Map = DenseMap<uint64_t, uint64_t>;

// Decode pseudo_probe_desc section to build GUID to PseudoProbeFuncDesc map.
bool buildGUID2FuncDescMap(const uint8_t *Start, std::size_t Size);
// If pseudo_probe_desc section is mapped to memory and \p IsMMapped is true,
// uses StringRefs pointing to the section.
bool buildGUID2FuncDescMap(const uint8_t *Start, std::size_t Size,
bool IsMMapped = false);

// Decode pseudo_probe section to count the number of probes and inlined
// function records for each function record.
Expand Down
6 changes: 4 additions & 2 deletions llvm/lib/MC/MCPseudoProbe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@ ErrorOr<StringRef> MCPseudoProbeDecoder::readString(uint32_t Size) {
}

bool MCPseudoProbeDecoder::buildGUID2FuncDescMap(const uint8_t *Start,
std::size_t Size) {
std::size_t Size,
bool IsMMapped) {
// The pseudo_probe_desc section has a format like:
// .section .pseudo_probe_desc,"",@progbits
// .quad -5182264717993193164 // GUID
Expand Down Expand Up @@ -422,7 +423,8 @@ bool MCPseudoProbeDecoder::buildGUID2FuncDescMap(const uint8_t *Start,
StringRef Name = cantFail(errorOrToExpected(readString(NameSize)));

// Initialize PseudoProbeFuncDesc and populate it into GUID2FuncDescMap
GUID2FuncDescMap.emplace_back(GUID, Hash, Name.copy(FuncNameAllocator));
GUID2FuncDescMap.emplace_back(
GUID, Hash, IsMMapped ? Name : Name.copy(FuncNameAllocator));
}
assert(Data == End && "Have unprocessed data in pseudo_probe_desc section");
assert(GUID2FuncDescMap.size() == FuncDescCount &&
Expand Down
Loading