aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-06-06 12:01:38 -0700
committerGitHub <noreply@github.com>2024-06-06 12:01:38 -0700
commitd55e235b2384281a5d1d982094fb2f819999885b (patch)
tree2e03e9af019e7038a73e96ee8436a3be3db30bbb /llvm/lib/ProfileData
parentf0785484c8ebf42ae0284cd608ad5f78eae20e95 (diff)
downloadllvm-d55e235b2384281a5d1d982094fb2f819999885b.zip
llvm-d55e235b2384281a5d1d982094fb2f819999885b.tar.gz
llvm-d55e235b2384281a5d1d982094fb2f819999885b.tar.bz2
[memprof] Use std::unique_ptr instead of std::optional (#94655)
Changing the type of Frame::SymbolName from std::optional<std::string> to std::unique<std::string> reduces sizeof(Frame) from 64 to 32. The smaller type reduces the cycle and instruction counts by 23% and 4.4%, respectively, with "llvm-profdata show" modified to deserialize all MemProfRecords in a MemProf V2 profile. The peak memory usage is cut down nearly by half.
Diffstat (limited to 'llvm/lib/ProfileData')
-rw-r--r--llvm/lib/ProfileData/MemProfReader.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/ProfileData/MemProfReader.cpp b/llvm/lib/ProfileData/MemProfReader.cpp
index fc3be71..693897f 100644
--- a/llvm/lib/ProfileData/MemProfReader.cpp
+++ b/llvm/lib/ProfileData/MemProfReader.cpp
@@ -690,7 +690,7 @@ Error RawMemProfReader::readNextRecord(
return F;
auto Iter = this->GuidToSymbolName.find(F.Function);
assert(Iter != this->GuidToSymbolName.end());
- F.SymbolName = Iter->getSecond();
+ F.SymbolName = std::make_unique<std::string>(Iter->getSecond());
return F;
};
return MemProfReader::readNextRecord(GuidRecord, IdToFrameCallback);