Skip to content

Commit 1aa3ca5

Browse files
[memprof] Remove inline call stacks
Now that MemProf format version 1 has been removed, nobody uses: - IndexedAllocationInfo::CallStack - IndexedMemProfRecord::CallSites This patch removed the dead struct fields. You might notice that IndexedMemProfRecord::{clear,merge} do not mention CallSiteIds at all. I think it's an oversight. clear doesn't matter at the moment because we call it during serialization to reduce memory footprint. merge is simply not as well tested as it should be. I'll follow up with a separate patch to address these issues.
1 parent 38a3cce commit 1aa3ca5

File tree

2 files changed

+2
-20
lines changed

2 files changed

+2
-20
lines changed

llvm/include/llvm/ProfileData/MemProf.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -344,21 +344,11 @@ using LinearCallStackId = uint32_t;
344344
struct IndexedAllocationInfo {
345345
// The dynamic calling context for the allocation in bottom-up (leaf-to-root)
346346
// order. Frame contents are stored out-of-line.
347-
// TODO: Remove once we fully transition to CSId.
348-
llvm::SmallVector<FrameId> CallStack;
349-
// Conceptually the same as above. We are going to keep both CallStack and
350-
// CallStackId while we are transitioning from CallStack to CallStackId.
351347
CallStackId CSId = 0;
352348
// The statistics obtained from the runtime for the allocation.
353349
PortableMemInfoBlock Info;
354350

355351
IndexedAllocationInfo() = default;
356-
// This constructor is soft deprecated. It will be removed once we remove all
357-
// users of the CallStack field.
358-
IndexedAllocationInfo(ArrayRef<FrameId> CS, CallStackId CSId,
359-
const MemInfoBlock &MB,
360-
const MemProfSchema &Schema = getFullSchema())
361-
: CallStack(CS), CSId(CSId), Info(MB, Schema) {}
362352
IndexedAllocationInfo(CallStackId CSId, const MemInfoBlock &MB,
363353
const MemProfSchema &Schema = getFullSchema())
364354
: CSId(CSId), Info(MB, Schema) {}
@@ -415,21 +405,14 @@ struct IndexedMemProfRecord {
415405
// list of inline locations in bottom-up order i.e. from leaf to root. The
416406
// inline location list may include additional entries, users should pick
417407
// the last entry in the list with the same function GUID.
418-
llvm::SmallVector<llvm::SmallVector<FrameId>> CallSites;
419-
// Conceptually the same as above. We are going to keep both CallSites and
420-
// CallSiteIds while we are transitioning from CallSites to CallSiteIds.
421408
llvm::SmallVector<CallStackId> CallSiteIds;
422409

423-
void clear() {
424-
AllocSites.clear();
425-
CallSites.clear();
426-
}
410+
void clear() { AllocSites.clear(); }
427411

428412
void merge(const IndexedMemProfRecord &Other) {
429413
// TODO: Filter out duplicates which may occur if multiple memprof
430414
// profiles are merged together using llvm-profdata.
431415
AllocSites.append(Other.AllocSites);
432-
CallSites.append(Other.CallSites);
433416
}
434417

435418
size_t serializedSize(const MemProfSchema &Schema,

llvm/lib/ProfileData/MemProfReader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ Error RawMemProfReader::mapRawProfileToRecords() {
507507
for (size_t I = 0; /*Break out using the condition below*/; I++) {
508508
const Frame &F = idToFrame(Callstack[I]);
509509
IndexedMemProfRecord &Record = MemProfData.Records[F.Function];
510-
Record.AllocSites.emplace_back(Callstack, CSId, MIB);
510+
Record.AllocSites.emplace_back(CSId, MIB);
511511

512512
if (!F.IsInlineFrame)
513513
break;
@@ -522,7 +522,6 @@ Error RawMemProfReader::mapRawProfileToRecords() {
522522
for (LocationPtr Loc : Locs) {
523523
CallStackId CSId = hashCallStack(*Loc);
524524
MemProfData.CallStacks.insert({CSId, *Loc});
525-
Record.CallSites.push_back(*Loc);
526525
Record.CallSiteIds.push_back(CSId);
527526
}
528527
}

0 commit comments

Comments
 (0)