Skip to content

Commit a43e309

Browse files
committed
[MemProf] Include caller clone information in dot graph nodes
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 42a081e commit a43e309

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-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+
auto 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: 3 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,8 @@ 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+
; DOTFUNCASSIGN: _Z3bazv.memprof.1 -\> _Z3barv.memprof.1
375+
; DOTFUNCASSIGN: _Z3barv.memprof.1 -\> alloc
373376

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

0 commit comments

Comments
 (0)