aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/ProfileData/InstrProfWriter.cpp
diff options
context:
space:
mode:
authorKazu Hirata <kazu@google.com>2024-05-31 14:41:05 -0700
committerGitHub <noreply@github.com>2024-05-31 14:41:05 -0700
commit9a8b73c7413002b4b4015a5b9ba27ad4482809aa (patch)
treee51e3ad42f6bfd482ebd176fea5009b898b6852e /llvm/lib/ProfileData/InstrProfWriter.cpp
parent62c61aa2bf23b7d886578708ec56b3ff07c3fcb0 (diff)
downloadllvm-9a8b73c7413002b4b4015a5b9ba27ad4482809aa.zip
llvm-9a8b73c7413002b4b4015a5b9ba27ad4482809aa.tar.gz
llvm-9a8b73c7413002b4b4015a5b9ba27ad4482809aa.tar.bz2
[memprof] Replace uint32_t with LinearCallStackId where appropriate (NFC) (#94023)
This patch replaces uint32_t with LinearCallStackId where appropriate. I'm replacing uint64_t with LinearCallStackId in writeMemProfCallStackArray, but that's OK because it's a value to be used as LinearCallStackId anyway.
Diffstat (limited to 'llvm/lib/ProfileData/InstrProfWriter.cpp')
-rw-r--r--llvm/lib/ProfileData/InstrProfWriter.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/llvm/lib/ProfileData/InstrProfWriter.cpp b/llvm/lib/ProfileData/InstrProfWriter.cpp
index 059617a..9b12922 100644
--- a/llvm/lib/ProfileData/InstrProfWriter.cpp
+++ b/llvm/lib/ProfileData/InstrProfWriter.cpp
@@ -454,8 +454,8 @@ static uint64_t writeMemProfRecords(
llvm::MapVector<GlobalValue::GUID, memprof::IndexedMemProfRecord>
&MemProfRecordData,
memprof::MemProfSchema *Schema, memprof::IndexedVersion Version,
- llvm::DenseMap<memprof::CallStackId, uint32_t> *MemProfCallStackIndexes =
- nullptr) {
+ llvm::DenseMap<memprof::CallStackId, memprof::LinearCallStackId>
+ *MemProfCallStackIndexes = nullptr) {
memprof::RecordWriterTrait RecordWriter(Schema, Version,
MemProfCallStackIndexes);
OnDiskChainedHashTableGenerator<memprof::RecordWriterTrait>
@@ -536,18 +536,20 @@ static uint64_t writeMemProfCallStacks(
return CallStackTableGenerator.Emit(OS.OS);
}
-static llvm::DenseMap<memprof::CallStackId, uint32_t>
+static llvm::DenseMap<memprof::CallStackId, memprof::LinearCallStackId>
writeMemProfCallStackArray(
ProfOStream &OS,
llvm::MapVector<memprof::CallStackId, llvm::SmallVector<memprof::FrameId>>
&MemProfCallStackData,
llvm::DenseMap<memprof::FrameId, uint32_t> &MemProfFrameIndexes) {
- llvm::DenseMap<memprof::CallStackId, uint32_t> MemProfCallStackIndexes;
+ llvm::DenseMap<memprof::CallStackId, memprof::LinearCallStackId>
+ MemProfCallStackIndexes;
MemProfCallStackIndexes.reserve(MemProfCallStackData.size());
uint64_t CallStackBase = OS.tell();
for (const auto &[CSId, CallStack] : MemProfCallStackData) {
- uint64_t CallStackIndex = (OS.tell() - CallStackBase) / sizeof(uint32_t);
+ memprof::LinearCallStackId CallStackIndex =
+ (OS.tell() - CallStackBase) / sizeof(memprof::LinearCallStackId);
MemProfCallStackIndexes.insert({CSId, CallStackIndex});
const llvm::SmallVector<memprof::FrameId> CS = CallStack;
OS.write32(CS.size());
@@ -712,9 +714,9 @@ static Error writeMemProfV3(ProfOStream &OS,
writeMemProfFrameArray(OS, MemProfData.FrameData);
uint64_t CallStackPayloadOffset = OS.tell();
- llvm::DenseMap<memprof::CallStackId, uint32_t> MemProfCallStackIndexes =
- writeMemProfCallStackArray(OS, MemProfData.CallStackData,
- MemProfFrameIndexes);
+ llvm::DenseMap<memprof::CallStackId, memprof::LinearCallStackId>
+ MemProfCallStackIndexes = writeMemProfCallStackArray(
+ OS, MemProfData.CallStackData, MemProfFrameIndexes);
uint64_t RecordPayloadOffset = OS.tell();
uint64_t RecordTableOffset =