Skip to content

Commit 9dc3fab

Browse files
teresajohnsonmahesh-attarde
authored andcommitted
[MemProf] Include caller clone information in dot graph nodes (llvm#150492)
We already included the assigned clone of the callsite node's callee in the dot graph after function assignment. This adds the same information for the enclosing caller function to aid debugging.
1 parent 6c3adcc commit 9dc3fab

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

llvm/lib/Transforms/IPO/MemProfContextDisambiguation.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2073,14 +2073,14 @@ std::string IndexCallsiteContextGraph::getLabel(const FunctionSummary *Func,
20732073
unsigned CloneNo) const {
20742074
auto VI = FSToVIMap.find(Func);
20752075
assert(VI != FSToVIMap.end());
2076+
std::string CallerName = getMemProfFuncName(VI->second.name(), CloneNo);
20762077
if (isa<AllocInfo *>(Call))
2077-
return (VI->second.name() + " -> alloc").str();
2078+
return CallerName + " -> alloc";
20782079
else {
20792080
auto *Callsite = dyn_cast_if_present<CallsiteInfo *>(Call);
2080-
return (VI->second.name() + " -> " +
2081-
getMemProfFuncName(Callsite->Callee.name(),
2082-
Callsite->Clones[CloneNo]))
2083-
.str();
2081+
return CallerName + " -> " +
2082+
getMemProfFuncName(Callsite->Callee.name(),
2083+
Callsite->Clones[CloneNo]);
20842084
}
20852085
}
20862086

llvm/test/ThinLTO/X86/memprof-basic.ll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
; RUN: cat %t.ccg.postbuild.dot | FileCheck %s --check-prefix=DOT
5353
;; We should have cloned bar, baz, and foo, for the cold memory allocation.
5454
; RUN: cat %t.ccg.cloned.dot | FileCheck %s --check-prefix=DOTCLONED
55+
; RUN: cat %t.ccg.clonefuncassign.dot | FileCheck %s --check-prefix=DOTFUNCASSIGN
5556

5657
; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --check-prefix=IR
5758

@@ -370,6 +371,10 @@ attributes #0 = { noinline optnone }
370371
; DOTCLONED: Node[[BAR2]] [shape=record,tooltip="N[[BAR2]] ContextIds: 2",fillcolor="cyan",color="blue",style="filled,bold,dashed",label="{OrigId: Alloc0\n_Z3barv -\> alloc}"];
371372
; DOTCLONED: }
372373

374+
;; Here we are just ensuring that the post-function assign dot graph includes
375+
;; clone information for both the caller and callee in the node labels.
376+
; DOTFUNCASSIGN: _Z3bazv.memprof.1 -\> _Z3barv.memprof.1
377+
; DOTFUNCASSIGN: _Z3barv.memprof.1 -\> alloc
373378

374379
; DISTRIB: ^[[BAZ:[0-9]+]] = gv: (guid: 1807954217441101578, {{.*}} callsites: ((callee: ^[[BAR:[0-9]+]], clones: (0, 1)
375380
; DISTRIB: ^[[FOO:[0-9]+]] = gv: (guid: 8107868197919466657, {{.*}} callsites: ((callee: ^[[BAZ]], clones: (0, 1)

0 commit comments

Comments
 (0)