Skip to content

Commit d2a103e

Browse files
[memprof] Remove const from the return type of toMemProfRecord (#93415)
"const" being removed in this patch prevents the move semantics from being used in: AI.CallStack = Callback(IndexedAI.CSId); With this patch on an indexed MemProf Version 2 profile, the cycle count and instruction count go down by 13.3% and 26.3%, respectively, with "llvm-profdata show" modified to deserialize all MemProfRecords.
1 parent 3864bfd commit d2a103e

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

llvm/include/llvm/ProfileData/MemProf.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,8 +426,8 @@ struct IndexedMemProfRecord {
426426
// Convert IndexedMemProfRecord to MemProfRecord. Callback is used to
427427
// translate CallStackId to call stacks with frames inline.
428428
MemProfRecord toMemProfRecord(
429-
llvm::function_ref<const llvm::SmallVector<Frame>(const CallStackId)>
430-
Callback) const;
429+
llvm::function_ref<llvm::SmallVector<Frame>(const CallStackId)> Callback)
430+
const;
431431

432432
// Returns the GUID for the function name after canonicalization. For
433433
// memprof, we remove any .llvm suffix added by LTO. MemProfRecords are

llvm/lib/ProfileData/MemProf.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,8 @@ IndexedMemProfRecord::deserialize(const MemProfSchema &Schema,
245245
}
246246

247247
MemProfRecord IndexedMemProfRecord::toMemProfRecord(
248-
llvm::function_ref<const llvm::SmallVector<Frame>(const CallStackId)>
249-
Callback) const {
248+
llvm::function_ref<llvm::SmallVector<Frame>(const CallStackId)> Callback)
249+
const {
250250
MemProfRecord Record;
251251

252252
Record.AllocSites.reserve(AllocSites.size());

0 commit comments

Comments
 (0)