Skip to content

Commit 3ce8b7d

Browse files
[memprof] Remove inline call stacks (#117833)
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 92a15dd commit 3ce8b7d

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
@@ -351,21 +351,11 @@ using LinearCallStackId = uint32_t;
351351
struct IndexedAllocationInfo {
352352
// The dynamic calling context for the allocation in bottom-up (leaf-to-root)
353353
// order. Frame contents are stored out-of-line.
354-
// TODO: Remove once we fully transition to CSId.
355-
llvm::SmallVector<FrameId> CallStack;
356-
// Conceptually the same as above. We are going to keep both CallStack and
357-
// CallStackId while we are transitioning from CallStack to CallStackId.
358354
CallStackId CSId = 0;
359355
// The statistics obtained from the runtime for the allocation.
360356
PortableMemInfoBlock Info;
361357

362358
IndexedAllocationInfo() = default;
363-
// This constructor is soft deprecated. It will be removed once we remove all
364-
// users of the CallStack field.
365-
IndexedAllocationInfo(ArrayRef<FrameId> CS, CallStackId CSId,
366-
const MemInfoBlock &MB,
367-
const MemProfSchema &Schema = getFullSchema())
368-
: CallStack(CS), CSId(CSId), Info(MB, Schema) {}
369359
IndexedAllocationInfo(CallStackId CSId, const MemInfoBlock &MB,
370360
const MemProfSchema &Schema = getFullSchema())
371361
: CSId(CSId), Info(MB, Schema) {}
@@ -424,21 +414,14 @@ struct IndexedMemProfRecord {
424414
// list of inline locations in bottom-up order i.e. from leaf to root. The
425415
// inline location list may include additional entries, users should pick
426416
// the last entry in the list with the same function GUID.
427-
llvm::SmallVector<llvm::SmallVector<FrameId>> CallSites;
428-
// Conceptually the same as above. We are going to keep both CallSites and
429-
// CallSiteIds while we are transitioning from CallSites to CallSiteIds.
430417
llvm::SmallVector<CallStackId> CallSiteIds;
431418

432-
void clear() {
433-
AllocSites.clear();
434-
CallSites.clear();
435-
}
419+
void clear() { AllocSites.clear(); }
436420

437421
void merge(const IndexedMemProfRecord &Other) {
438422
// TODO: Filter out duplicates which may occur if multiple memprof
439423
// profiles are merged together using llvm-profdata.
440424
AllocSites.append(Other.AllocSites);
441-
CallSites.append(Other.CallSites);
442425
}
443426

444427
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
@@ -599,7 +599,7 @@ Error RawMemProfReader::mapRawProfileToRecords() {
599599
for (size_t I = 0; /*Break out using the condition below*/; I++) {
600600
const Frame &F = idToFrame(Callstack[I]);
601601
IndexedMemProfRecord &Record = MemProfData.Records[F.Function];
602-
Record.AllocSites.emplace_back(Callstack, CSId, MIB);
602+
Record.AllocSites.emplace_back(CSId, MIB);
603603

604604
if (!F.IsInlineFrame)
605605
break;
@@ -614,7 +614,6 @@ Error RawMemProfReader::mapRawProfileToRecords() {
614614
for (LocationPtr Loc : Locs) {
615615
CallStackId CSId = hashCallStack(*Loc);
616616
MemProfData.CallStacks.insert({CSId, *Loc});
617-
Record.CallSites.push_back(*Loc);
618617
Record.CallSiteIds.push_back(CSId);
619618
}
620619
}

0 commit comments

Comments
 (0)