Skip to content

[MemProf] Print internal context id when reporting bytes hinted #128188

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2949,6 +2949,8 @@ void CallsiteContextGraph<DerivedCCG, FuncTy, CallTy>::printTotalSizes(
if (allocTypeToUse(Node->AllocTypes) != AllocTypeFromCall)
OS << " marked " << getAllocTypeString((uint8_t)AllocTypeFromCall)
<< " due to cold byte percent";
// Print the internal context id to aid debugging and visualization.
OS << " (context id " << Id << ")";
OS << "\n";
}
}
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/ThinLTO/X86/memprof-basic.ll
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,9 @@ attributes #0 = { noinline optnone }
; DUMP: Edge from Callee [[BAR2]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 2
; DUMP: Clone of [[BAR]]

; SIZES: NotCold full allocation context 123 with total size 100 is NotCold after cloning
; SIZES: Cold full allocation context 456 with total size 200 is Cold after cloning
; SIZES: Cold full allocation context 789 with total size 300 is Cold after cloning
; SIZES: NotCold full allocation context 123 with total size 100 is NotCold after cloning (context id 1)
; SIZES: Cold full allocation context 456 with total size 200 is Cold after cloning (context id 2)
; SIZES: Cold full allocation context 789 with total size 300 is Cold after cloning (context id 2)

; REMARKS: call in clone main assigned to call function clone _Z3foov.memprof.1
; REMARKS: created clone _Z3barv.memprof.1
Expand Down
6 changes: 3 additions & 3 deletions llvm/test/Transforms/MemProfContextDisambiguation/basic.ll
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ attributes #6 = { builtin }
; REMARKS: call in clone _Z3bazv assigned to call function clone _Z3barv
; REMARKS: call in clone _Z3barv marked with memprof allocation attribute notcold

; SIZES: NotCold full allocation context 123 with total size 100 is NotCold after cloning
; SIZES: Cold full allocation context 456 with total size 200 is Cold after cloning
; SIZES: Cold full allocation context 789 with total size 300 is Cold after cloning
; SIZES: NotCold full allocation context 123 with total size 100 is NotCold after cloning (context id 1)
; SIZES: Cold full allocation context 456 with total size 200 is Cold after cloning (context id 2)
; SIZES: Cold full allocation context 789 with total size 300 is Cold after cloning (context id 2)

; IR: define {{.*}} @main
;; The first call to foo does not allocate cold memory. It should call the
Expand Down