aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/CodeGen/MachineBlockPlacement.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-11-18 08:56:25 -0800
committerGitHub <noreply@github.com>2024-11-18 08:56:25 -0800
commit6bf8f08989420ccd10efed5fac88052ca16e1250 (patch)
tree291e25d131ec4600bf4caa9459b1a5db480e92b3 /llvm/lib/CodeGen/MachineBlockPlacement.cpp
parentb7d635ed30da49cc32b5b46d00e67ecc3ff9522f (diff)
downloadllvm-6bf8f08989420ccd10efed5fac88052ca16e1250.zip
llvm-6bf8f08989420ccd10efed5fac88052ca16e1250.tar.gz
llvm-6bf8f08989420ccd10efed5fac88052ca16e1250.tar.bz2
[memprof] Add InstrProfWriter::addMemProfData (#116528)
This patch adds InstrProfWriter::addMemProfData, which adds the complete MemProf profile (frames, call stacks, and records) to the writer context. Without this function, functions like loadInput in llvm-profdata.cpp and InstrProfWriter::mergeRecordsFromWriter must add one item (frame, call stack, or record) at a time. The new function std::moves the entire MemProf profile to the writer context if the destination is empty, which is the common use case. Otherwise, we fall back to adding one item at a time behind the scene. Here are a couple of reasons why we should add this function: - We've had a bug where we forgot to add one of the three data structures (frames, call stacks, and records) to the writer context, resulting in a nearly empty indexed profile. We should always package the three data structures together, especially on API boundaries. - We expose a little too much of the MemProf detail to InstrProfWriter. I'd like to gradually transform InstrProfReader/Writer to entities managing buffers (sequences of bytes), with actual serialization/deserialization left to external classes. We already do some of this in InstrProfReader, where InstrProfReader "contracts out" to IndexedMemProfReader to handle MemProf details. I am not changing loadInput or InstrProfWriter::mergeRecordsFromWriter for now because MemProfReader uses DenseMap for frames and call stacks, whereas MemProfData uses MapVector. I'll resolve these mismatches in subsequent patches.
Diffstat (limited to 'llvm/lib/CodeGen/MachineBlockPlacement.cpp')
0 files changed, 0 insertions, 0 deletions