aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/InstrProfWriter.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-11-24 21:08:54 -0800
committerGitHub <noreply@github.com>2024-11-24 21:08:54 -0800
commitff7b42c194e0fa23e6a76f0a33a80c0c3af14e7d (patch)
tree1420d356236d4a090ea76ea38a254a589ced5168 /llvm/lib/ProfileData/InstrProfWriter.cpp
parent9e3215ac167b80dcf51d6693ecdd6275c4e89954 (diff)
downloadllvm-ff7b42c194e0fa23e6a76f0a33a80c0c3af14e7d.zip
llvm-ff7b42c194e0fa23e6a76f0a33a80c0c3af14e7d.tar.gz
llvm-ff7b42c194e0fa23e6a76f0a33a80c0c3af14e7d.tar.bz2
[memprof] Speed up llvm-profdata (#117446)
CallStackRadixTreeBuilder::build takes the parameter MemProfFrameIndexes by value, involving copies: std::optional<const llvm::DenseMap<FrameIdTy, LinearFrameId>> MemProfFrameIndexes Then "build" makes another copy of MemProfFrameIndexe and passes it to encodeCallStack for every call stack, which is painfully slow. This patch changes the type to a pointer so that we don't have to make a copy every time we pass the argument. Without this patch, it takes 553 seconds to run "llvm-profdata merge" on a large MemProf raw profile. This patch shortenes that down to 67 seconds.
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfWriter.cpp')
-rw-r--r--llvm/lib/ProfileData/InstrProfWriter.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index 4470e2c..d8ab18d 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -641,7 +641,7 @@ writeMemProfCallStackArray(
MemProfCallStackIndexes;
memprof::CallStackRadixTreeBuilder<memprof::FrameId> Builder;
- Builder.build(std::move(MemProfCallStackData), MemProfFrameIndexes,
+ Builder.build(std::move(MemProfCallStackData), &MemProfFrameIndexes,
FrameHistogram);
for (auto I : Builder.getRadixArray())
OS.write32(I);