1fe27495bSTeresa Johnson;; Test callsite context graph generation for simple call graph with 2fe27495bSTeresa Johnson;; two memprof contexts and no inlining. 3fe27495bSTeresa Johnson;; 4fe27495bSTeresa Johnson;; Original code looks like: 5fe27495bSTeresa Johnson;; 6fe27495bSTeresa Johnson;; char *bar() { 7fe27495bSTeresa Johnson;; return new char[10]; 8fe27495bSTeresa Johnson;; } 9fe27495bSTeresa Johnson;; 10fe27495bSTeresa Johnson;; char *baz() { 11fe27495bSTeresa Johnson;; return bar(); 12fe27495bSTeresa Johnson;; } 13fe27495bSTeresa Johnson;; 14fe27495bSTeresa Johnson;; char *foo() { 15fe27495bSTeresa Johnson;; return baz(); 16fe27495bSTeresa Johnson;; } 17fe27495bSTeresa Johnson;; 18fe27495bSTeresa Johnson;; int main(int argc, char **argv) { 19fe27495bSTeresa Johnson;; char *x = foo(); 20fe27495bSTeresa Johnson;; char *y = foo(); 21fe27495bSTeresa Johnson;; memset(x, 0, 10); 22fe27495bSTeresa Johnson;; memset(y, 0, 10); 23fe27495bSTeresa Johnson;; delete[] x; 24fe27495bSTeresa Johnson;; sleep(10); 25fe27495bSTeresa Johnson;; delete[] y; 26fe27495bSTeresa Johnson;; return 0; 27fe27495bSTeresa Johnson;; } 28fe27495bSTeresa Johnson;; 29a4bdb275STeresa Johnson;; Code compiled with -mllvm -memprof-ave-lifetime-cold-threshold=5 so that the 30fe27495bSTeresa Johnson;; memory freed after sleep(10) results in cold lifetimes. 31fe27495bSTeresa Johnson;; 32fe27495bSTeresa Johnson;; The IR was then reduced using llvm-reduce with the expected FileCheck input. 33fe27495bSTeresa Johnson 34e3e6bc69STeresa Johnson;; -stats requires asserts 35e3e6bc69STeresa Johnson; REQUIRES: asserts 36e3e6bc69STeresa Johnson 379f8205d9STeresa Johnson; RUN: opt -thinlto-bc -memprof-report-hinted-sizes %s >%t.o 38fe27495bSTeresa Johnson; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \ 3917688986STeresa Johnson; RUN: -supports-hot-cold-new \ 40fe27495bSTeresa Johnson; RUN: -r=%t.o,main,plx \ 41fe27495bSTeresa Johnson; RUN: -r=%t.o,_ZdaPv, \ 42fe27495bSTeresa Johnson; RUN: -r=%t.o,sleep, \ 43fe27495bSTeresa Johnson; RUN: -r=%t.o,_Znam, \ 44fe27495bSTeresa Johnson; RUN: -memprof-verify-ccg -memprof-verify-nodes -memprof-dump-ccg \ 45fe27495bSTeresa Johnson; RUN: -memprof-export-to-dot -memprof-dot-file-path-prefix=%t. \ 469f8205d9STeresa Johnson; RUN: -memprof-report-hinted-sizes \ 4704f3c5a7STeresa Johnson; RUN: -stats -pass-remarks=memprof-context-disambiguation -save-temps \ 48*9513f2fdSTeresa Johnson; RUN: -o %t.out 2>&1 | FileCheck %s --check-prefix=DUMP --check-prefix=DUMP-SIZES \ 499f8205d9STeresa Johnson; RUN: --check-prefix=STATS --check-prefix=STATS-BE --check-prefix=REMARKS \ 509f8205d9STeresa Johnson; RUN: --check-prefix=SIZES 51fe27495bSTeresa Johnson 52fe27495bSTeresa Johnson; RUN: cat %t.ccg.postbuild.dot | FileCheck %s --check-prefix=DOT 53a104e270STeresa Johnson;; We should have cloned bar, baz, and foo, for the cold memory allocation. 54a104e270STeresa Johnson; RUN: cat %t.ccg.cloned.dot | FileCheck %s --check-prefix=DOTCLONED 55fe27495bSTeresa Johnson 56becc02ceSYonghong Song; RUN: llvm-dis %t.out.1.4.opt.bc -o - | FileCheck %s --check-prefix=IR 57cfad2d3aSTeresa Johnson 58fe27495bSTeresa Johnson 5904f3c5a7STeresa Johnson;; Try again but with distributed ThinLTO 6004f3c5a7STeresa Johnson; RUN: llvm-lto2 run %t.o -enable-memprof-context-disambiguation \ 6117688986STeresa Johnson; RUN: -supports-hot-cold-new \ 6204f3c5a7STeresa Johnson; RUN: -thinlto-distributed-indexes \ 6304f3c5a7STeresa Johnson; RUN: -r=%t.o,main,plx \ 6404f3c5a7STeresa Johnson; RUN: -r=%t.o,_ZdaPv, \ 6504f3c5a7STeresa Johnson; RUN: -r=%t.o,sleep, \ 6604f3c5a7STeresa Johnson; RUN: -r=%t.o,_Znam, \ 6704f3c5a7STeresa Johnson; RUN: -memprof-verify-ccg -memprof-verify-nodes -memprof-dump-ccg \ 6804f3c5a7STeresa Johnson; RUN: -memprof-export-to-dot -memprof-dot-file-path-prefix=%t2. \ 699f8205d9STeresa Johnson; RUN: -memprof-report-hinted-sizes \ 7004f3c5a7STeresa Johnson; RUN: -stats -pass-remarks=memprof-context-disambiguation \ 7104f3c5a7STeresa Johnson; RUN: -o %t2.out 2>&1 | FileCheck %s --check-prefix=DUMP \ 729f8205d9STeresa Johnson; RUN: --check-prefix=STATS --check-prefix=SIZES 7304f3c5a7STeresa Johnson 7404f3c5a7STeresa Johnson; RUN: cat %t2.ccg.postbuild.dot | FileCheck %s --check-prefix=DOT 7504f3c5a7STeresa Johnson;; We should have cloned bar, baz, and foo, for the cold memory allocation. 7604f3c5a7STeresa Johnson; RUN: cat %t2.ccg.cloned.dot | FileCheck %s --check-prefix=DOTCLONED 7704f3c5a7STeresa Johnson 7804f3c5a7STeresa Johnson;; Check distributed index 7904f3c5a7STeresa Johnson; RUN: llvm-dis %t.o.thinlto.bc -o - | FileCheck %s --check-prefix=DISTRIB 8004f3c5a7STeresa Johnson 81cfad2d3aSTeresa Johnson;; Run ThinLTO backend 82cfad2d3aSTeresa Johnson; RUN: opt -passes=memprof-context-disambiguation \ 83cfad2d3aSTeresa Johnson; RUN: -memprof-import-summary=%t.o.thinlto.bc \ 84cfad2d3aSTeresa Johnson; RUN: -stats -pass-remarks=memprof-context-disambiguation \ 85cfad2d3aSTeresa Johnson; RUN: %t.o -S 2>&1 | FileCheck %s --check-prefix=IR \ 86cfad2d3aSTeresa Johnson; RUN: --check-prefix=STATS-BE --check-prefix=REMARKS 87cfad2d3aSTeresa Johnson 88fe27495bSTeresa Johnsonsource_filename = "memprof-basic.ll" 89fe27495bSTeresa Johnsontarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 90fe27495bSTeresa Johnsontarget triple = "x86_64-unknown-linux-gnu" 91fe27495bSTeresa Johnson 92cfad2d3aSTeresa Johnsondefine i32 @main() #0 { 93fe27495bSTeresa Johnsonentry: 94fe27495bSTeresa Johnson %call = call ptr @_Z3foov(), !callsite !0 95fe27495bSTeresa Johnson %call1 = call ptr @_Z3foov(), !callsite !1 96fe27495bSTeresa Johnson ret i32 0 97fe27495bSTeresa Johnson} 98fe27495bSTeresa Johnson 99fe27495bSTeresa Johnsondeclare void @_ZdaPv() 100fe27495bSTeresa Johnson 101fe27495bSTeresa Johnsondeclare i32 @sleep() 102fe27495bSTeresa Johnson 103cfad2d3aSTeresa Johnsondefine internal ptr @_Z3barv() #0 { 104fe27495bSTeresa Johnsonentry: 105fe27495bSTeresa Johnson %call = call ptr @_Znam(i64 0), !memprof !2, !callsite !7 106fe27495bSTeresa Johnson ret ptr null 107fe27495bSTeresa Johnson} 108fe27495bSTeresa Johnson 109fe27495bSTeresa Johnsondeclare ptr @_Znam(i64) 110fe27495bSTeresa Johnson 111cfad2d3aSTeresa Johnsondefine internal ptr @_Z3bazv() #0 { 112fe27495bSTeresa Johnsonentry: 113fe27495bSTeresa Johnson %call = call ptr @_Z3barv(), !callsite !8 114fe27495bSTeresa Johnson ret ptr null 115fe27495bSTeresa Johnson} 116fe27495bSTeresa Johnson 117cfad2d3aSTeresa Johnsondefine internal ptr @_Z3foov() #0 { 118fe27495bSTeresa Johnsonentry: 119fe27495bSTeresa Johnson %call = call ptr @_Z3bazv(), !callsite !9 120fe27495bSTeresa Johnson ret ptr null 121fe27495bSTeresa Johnson} 122fe27495bSTeresa Johnson 123fe27495bSTeresa Johnson; uselistorder directives 124fe27495bSTeresa Johnsonuselistorder ptr @_Z3foov, { 1, 0 } 125fe27495bSTeresa Johnson 126cfad2d3aSTeresa Johnsonattributes #0 = { noinline optnone } 127cfad2d3aSTeresa Johnson 128fe27495bSTeresa Johnson!0 = !{i64 8632435727821051414} 129fe27495bSTeresa Johnson!1 = !{i64 -3421689549917153178} 130fe27495bSTeresa Johnson!2 = !{!3, !5} 131*9513f2fdSTeresa Johnson!3 = !{!4, !"notcold", !10} 132fe27495bSTeresa Johnson!4 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 8632435727821051414} 133*9513f2fdSTeresa Johnson!5 = !{!6, !"cold", !11, !12} 134fe27495bSTeresa Johnson!6 = !{i64 9086428284934609951, i64 -5964873800580613432, i64 2732490490862098848, i64 -3421689549917153178} 135fe27495bSTeresa Johnson!7 = !{i64 9086428284934609951} 136fe27495bSTeresa Johnson!8 = !{i64 -5964873800580613432} 137fe27495bSTeresa Johnson!9 = !{i64 2732490490862098848} 138*9513f2fdSTeresa Johnson!10 = !{i64 123, i64 100} 139*9513f2fdSTeresa Johnson!11 = !{i64 456, i64 200} 140*9513f2fdSTeresa Johnson!12 = !{i64 789, i64 300} 141fe27495bSTeresa Johnson 142fe27495bSTeresa Johnson 143fe27495bSTeresa Johnson; DUMP: CCG before cloning: 144fe27495bSTeresa Johnson; DUMP: Callsite Context Graph: 145fe27495bSTeresa Johnson; DUMP: Node [[BAR:0x[a-z0-9]+]] 146fe27495bSTeresa Johnson; DUMP: Versions: 1 MIB: 147fe27495bSTeresa Johnson; DUMP: AllocType 1 StackIds: 2, 3, 0 148fe27495bSTeresa Johnson; DUMP: AllocType 2 StackIds: 2, 3, 1 149*9513f2fdSTeresa Johnson; DUMP-SIZES: ContextSizeInfo per MIB: 150*9513f2fdSTeresa Johnson; DUMP-SIZES: { 123, 100 } 151*9513f2fdSTeresa Johnson; DUMP-SIZES: { 456, 200 }, { 789, 300 } 152fe27495bSTeresa Johnson; DUMP: (clone 0) 153fe27495bSTeresa Johnson; DUMP: AllocTypes: NotColdCold 154fe27495bSTeresa Johnson; DUMP: ContextIds: 1 2 155fe27495bSTeresa Johnson; DUMP: CalleeEdges: 156fe27495bSTeresa Johnson; DUMP: CallerEdges: 157fe27495bSTeresa Johnson; DUMP: Edge from Callee [[BAR]] to Caller: [[BAZ:0x[a-z0-9]+]] AllocTypes: NotColdCold ContextIds: 1 2 158fe27495bSTeresa Johnson 159fe27495bSTeresa Johnson; DUMP: Node [[BAZ]] 16078a195e1SMingming Liu; DUMP: Callee: 11481133863268513686 (_Z3barv) Clones: 0 StackIds: 2 (clone 0) 161fe27495bSTeresa Johnson; DUMP: AllocTypes: NotColdCold 162fe27495bSTeresa Johnson; DUMP: ContextIds: 1 2 163fe27495bSTeresa Johnson; DUMP: CalleeEdges: 164fe27495bSTeresa Johnson; DUMP: Edge from Callee [[BAR]] to Caller: [[BAZ]] AllocTypes: NotColdCold ContextIds: 1 2 165fe27495bSTeresa Johnson; DUMP: CallerEdges: 166fe27495bSTeresa Johnson; DUMP: Edge from Callee [[BAZ]] to Caller: [[FOO:0x[a-z0-9]+]] AllocTypes: NotColdCold ContextIds: 1 2 167fe27495bSTeresa Johnson 168fe27495bSTeresa Johnson; DUMP: Node [[FOO]] 16978a195e1SMingming Liu; DUMP: Callee: 1807954217441101578 (_Z3bazv) Clones: 0 StackIds: 3 (clone 0) 170fe27495bSTeresa Johnson; DUMP: AllocTypes: NotColdCold 171fe27495bSTeresa Johnson; DUMP: ContextIds: 1 2 172fe27495bSTeresa Johnson; DUMP: CalleeEdges: 173fe27495bSTeresa Johnson; DUMP: Edge from Callee [[BAZ]] to Caller: [[FOO]] AllocTypes: NotColdCold ContextIds: 1 2 174fe27495bSTeresa Johnson; DUMP: CallerEdges: 175fe27495bSTeresa Johnson; DUMP: Edge from Callee [[FOO]] to Caller: [[MAIN1:0x[a-z0-9]+]] AllocTypes: NotCold ContextIds: 1 176fe27495bSTeresa Johnson; DUMP: Edge from Callee [[FOO]] to Caller: [[MAIN2:0x[a-z0-9]+]] AllocTypes: Cold ContextIds: 2 177fe27495bSTeresa Johnson 178fe27495bSTeresa Johnson; DUMP: Node [[MAIN1]] 17978a195e1SMingming Liu; DUMP: Callee: 8107868197919466657 (_Z3foov) Clones: 0 StackIds: 0 (clone 0) 180fe27495bSTeresa Johnson; DUMP: AllocTypes: NotCold 181fe27495bSTeresa Johnson; DUMP: ContextIds: 1 182fe27495bSTeresa Johnson; DUMP: CalleeEdges: 183fe27495bSTeresa Johnson; DUMP: Edge from Callee [[FOO]] to Caller: [[MAIN1]] AllocTypes: NotCold ContextIds: 1 184fe27495bSTeresa Johnson; DUMP: CallerEdges: 185fe27495bSTeresa Johnson 186fe27495bSTeresa Johnson; DUMP: Node [[MAIN2]] 18778a195e1SMingming Liu; DUMP: Callee: 8107868197919466657 (_Z3foov) Clones: 0 StackIds: 1 (clone 0) 188fe27495bSTeresa Johnson; DUMP: AllocTypes: Cold 189fe27495bSTeresa Johnson; DUMP: ContextIds: 2 190fe27495bSTeresa Johnson; DUMP: CalleeEdges: 191fe27495bSTeresa Johnson; DUMP: Edge from Callee [[FOO]] to Caller: [[MAIN2]] AllocTypes: Cold ContextIds: 2 192fe27495bSTeresa Johnson; DUMP: CallerEdges: 193fe27495bSTeresa Johnson 194a104e270STeresa Johnson; DUMP: CCG after cloning: 195a104e270STeresa Johnson; DUMP: Callsite Context Graph: 196a104e270STeresa Johnson; DUMP: Node [[BAR]] 197a104e270STeresa Johnson; DUMP: Versions: 1 MIB: 198a104e270STeresa Johnson; DUMP: AllocType 1 StackIds: 2, 3, 0 199a104e270STeresa Johnson; DUMP: AllocType 2 StackIds: 2, 3, 1 200a104e270STeresa Johnson; DUMP: (clone 0) 201a104e270STeresa Johnson; DUMP: AllocTypes: NotCold 202a104e270STeresa Johnson; DUMP: ContextIds: 1 203a104e270STeresa Johnson; DUMP: CalleeEdges: 204a104e270STeresa Johnson; DUMP: CallerEdges: 205a104e270STeresa Johnson; DUMP: Edge from Callee [[BAR]] to Caller: [[BAZ]] AllocTypes: NotCold ContextIds: 1 206a104e270STeresa Johnson; DUMP: Clones: [[BAR2:0x[a-z0-9]+]] 207a104e270STeresa Johnson 208a104e270STeresa Johnson; DUMP: Node [[BAZ]] 20978a195e1SMingming Liu; DUMP: Callee: 11481133863268513686 (_Z3barv) Clones: 0 StackIds: 2 (clone 0) 210a104e270STeresa Johnson; DUMP: AllocTypes: NotCold 211a104e270STeresa Johnson; DUMP: ContextIds: 1 212a104e270STeresa Johnson; DUMP: CalleeEdges: 213a104e270STeresa Johnson; DUMP: Edge from Callee [[BAR]] to Caller: [[BAZ]] AllocTypes: NotCold ContextIds: 1 214a104e270STeresa Johnson; DUMP: CallerEdges: 215a104e270STeresa Johnson; DUMP: Edge from Callee [[BAZ]] to Caller: [[FOO]] AllocTypes: NotCold ContextIds: 1 216a104e270STeresa Johnson; DUMP: Clones: [[BAZ2:0x[a-z0-9]+]] 217a104e270STeresa Johnson 218a104e270STeresa Johnson; DUMP: Node [[FOO]] 21978a195e1SMingming Liu; DUMP: Callee: 1807954217441101578 (_Z3bazv) Clones: 0 StackIds: 3 (clone 0) 220a104e270STeresa Johnson; DUMP: AllocTypes: NotCold 221a104e270STeresa Johnson; DUMP: ContextIds: 1 222a104e270STeresa Johnson; DUMP: CalleeEdges: 223a104e270STeresa Johnson; DUMP: Edge from Callee [[BAZ]] to Caller: [[FOO]] AllocTypes: NotCold ContextIds: 1 224a104e270STeresa Johnson; DUMP: CallerEdges: 225a104e270STeresa Johnson; DUMP: Edge from Callee [[FOO]] to Caller: [[MAIN1]] AllocTypes: NotCold ContextIds: 1 226a104e270STeresa Johnson; DUMP: Clones: [[FOO2:0x[a-z0-9]+]] 227a104e270STeresa Johnson 228a104e270STeresa Johnson; DUMP: Node [[MAIN1]] 22978a195e1SMingming Liu; DUMP: Callee: 8107868197919466657 (_Z3foov) Clones: 0 StackIds: 0 (clone 0) 230a104e270STeresa Johnson; DUMP: AllocTypes: NotCold 231a104e270STeresa Johnson; DUMP: ContextIds: 1 232a104e270STeresa Johnson; DUMP: CalleeEdges: 233a104e270STeresa Johnson; DUMP: Edge from Callee [[FOO]] to Caller: [[MAIN1]] AllocTypes: NotCold ContextIds: 1 234a104e270STeresa Johnson; DUMP: CallerEdges: 235a104e270STeresa Johnson 236a104e270STeresa Johnson; DUMP: Node [[MAIN2]] 23778a195e1SMingming Liu; DUMP: Callee: 8107868197919466657 (_Z3foov) Clones: 0 StackIds: 1 (clone 0) 238a104e270STeresa Johnson; DUMP: AllocTypes: Cold 239a104e270STeresa Johnson; DUMP: ContextIds: 2 240a104e270STeresa Johnson; DUMP: CalleeEdges: 241a104e270STeresa Johnson; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN2]] AllocTypes: Cold ContextIds: 2 242a104e270STeresa Johnson; DUMP: CallerEdges: 243a104e270STeresa Johnson 244a104e270STeresa Johnson; DUMP: Node [[FOO2]] 24578a195e1SMingming Liu; DUMP: Callee: 1807954217441101578 (_Z3bazv) Clones: 0 StackIds: 3 (clone 0) 246a104e270STeresa Johnson; DUMP: AllocTypes: Cold 247a104e270STeresa Johnson; DUMP: ContextIds: 2 248a104e270STeresa Johnson; DUMP: CalleeEdges: 249a104e270STeresa Johnson; DUMP: Edge from Callee [[BAZ2]] to Caller: [[FOO2]] AllocTypes: Cold ContextIds: 2 250a104e270STeresa Johnson; DUMP: CallerEdges: 251a104e270STeresa Johnson; DUMP: Edge from Callee [[FOO2]] to Caller: [[MAIN2]] AllocTypes: Cold ContextIds: 2 252a104e270STeresa Johnson; DUMP: Clone of [[FOO]] 253a104e270STeresa Johnson 254a104e270STeresa Johnson; DUMP: Node [[BAZ2]] 25578a195e1SMingming Liu; DUMP: Callee: 11481133863268513686 (_Z3barv) Clones: 0 StackIds: 2 (clone 0) 256a104e270STeresa Johnson; DUMP: AllocTypes: Cold 257a104e270STeresa Johnson; DUMP: ContextIds: 2 258a104e270STeresa Johnson; DUMP: CalleeEdges: 259a104e270STeresa Johnson; DUMP: Edge from Callee [[BAR2]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 2 260a104e270STeresa Johnson; DUMP: CallerEdges: 261a104e270STeresa Johnson; DUMP: Edge from Callee [[BAZ2]] to Caller: [[FOO2]] AllocTypes: Cold ContextIds: 2 262a104e270STeresa Johnson; DUMP: Clone of [[BAZ]] 263a104e270STeresa Johnson 264a104e270STeresa Johnson; DUMP: Node [[BAR2]] 265a104e270STeresa Johnson; DUMP: Versions: 1 MIB: 266a104e270STeresa Johnson; DUMP: AllocType 1 StackIds: 2, 3, 0 267a104e270STeresa Johnson; DUMP: AllocType 2 StackIds: 2, 3, 1 268a104e270STeresa Johnson; DUMP: (clone 0) 269a104e270STeresa Johnson; DUMP: AllocTypes: Cold 270a104e270STeresa Johnson; DUMP: ContextIds: 2 271a104e270STeresa Johnson; DUMP: CalleeEdges: 272a104e270STeresa Johnson; DUMP: CallerEdges: 273a104e270STeresa Johnson; DUMP: Edge from Callee [[BAR2]] to Caller: [[BAZ2]] AllocTypes: Cold ContextIds: 2 274a104e270STeresa Johnson; DUMP: Clone of [[BAR]] 275a104e270STeresa Johnson 276*9513f2fdSTeresa Johnson; SIZES: NotCold full allocation context 123 with total size 100 is NotCold after cloning 277*9513f2fdSTeresa Johnson; SIZES: Cold full allocation context 456 with total size 200 is Cold after cloning 278*9513f2fdSTeresa Johnson; SIZES: Cold full allocation context 789 with total size 300 is Cold after cloning 279fe27495bSTeresa Johnson 280cfad2d3aSTeresa Johnson; REMARKS: call in clone main assigned to call function clone _Z3foov.memprof.1 281cfad2d3aSTeresa Johnson; REMARKS: created clone _Z3barv.memprof.1 282cfad2d3aSTeresa Johnson; REMARKS: call in clone _Z3barv marked with memprof allocation attribute notcold 283cfad2d3aSTeresa Johnson; REMARKS: call in clone _Z3barv.memprof.1 marked with memprof allocation attribute cold 284cfad2d3aSTeresa Johnson; REMARKS: created clone _Z3bazv.memprof.1 285cfad2d3aSTeresa Johnson; REMARKS: call in clone _Z3bazv.memprof.1 assigned to call function clone _Z3barv.memprof.1 286cfad2d3aSTeresa Johnson; REMARKS: created clone _Z3foov.memprof.1 287cfad2d3aSTeresa Johnson; REMARKS: call in clone _Z3foov.memprof.1 assigned to call function clone _Z3bazv.memprof.1 288cfad2d3aSTeresa Johnson 289cfad2d3aSTeresa Johnson 290cfad2d3aSTeresa Johnson; IR: define {{.*}} @main 291cfad2d3aSTeresa Johnson;; The first call to foo does not allocate cold memory. It should call the 292cfad2d3aSTeresa Johnson;; original functions, which ultimately call the original allocation decorated 293cfad2d3aSTeresa Johnson;; with a "notcold" attribute. 294cfad2d3aSTeresa Johnson; IR: call {{.*}} @_Z3foov() 295cfad2d3aSTeresa Johnson;; The second call to foo allocates cold memory. It should call cloned functions 296cfad2d3aSTeresa Johnson;; which ultimately call a cloned allocation decorated with a "cold" attribute. 297cfad2d3aSTeresa Johnson; IR: call {{.*}} @_Z3foov.memprof.1() 298cfad2d3aSTeresa Johnson; IR: define internal {{.*}} @_Z3barv() 299cfad2d3aSTeresa Johnson; IR: call {{.*}} @_Znam(i64 0) #[[NOTCOLD:[0-9]+]] 300cfad2d3aSTeresa Johnson; IR: define internal {{.*}} @_Z3bazv() 301cfad2d3aSTeresa Johnson; IR: call {{.*}} @_Z3barv() 302cfad2d3aSTeresa Johnson; IR: define internal {{.*}} @_Z3foov() 303cfad2d3aSTeresa Johnson; IR: call {{.*}} @_Z3bazv() 304cfad2d3aSTeresa Johnson; IR: define internal {{.*}} @_Z3barv.memprof.1() 305cfad2d3aSTeresa Johnson; IR: call {{.*}} @_Znam(i64 0) #[[COLD:[0-9]+]] 306cfad2d3aSTeresa Johnson; IR: define internal {{.*}} @_Z3bazv.memprof.1() 307cfad2d3aSTeresa Johnson; IR: call {{.*}} @_Z3barv.memprof.1() 308cfad2d3aSTeresa Johnson; IR: define internal {{.*}} @_Z3foov.memprof.1() 309cfad2d3aSTeresa Johnson; IR: call {{.*}} @_Z3bazv.memprof.1() 310cfad2d3aSTeresa Johnson; IR: attributes #[[NOTCOLD]] = { "memprof"="notcold" } 311cfad2d3aSTeresa Johnson; IR: attributes #[[COLD]] = { "memprof"="cold" } 312cfad2d3aSTeresa Johnson 313cfad2d3aSTeresa Johnson 31404f3c5a7STeresa Johnson; STATS: 1 memprof-context-disambiguation - Number of cold static allocations (possibly cloned) 315cfad2d3aSTeresa Johnson; STATS-BE: 1 memprof-context-disambiguation - Number of cold static allocations (possibly cloned) during ThinLTO backend 31604f3c5a7STeresa Johnson; STATS: 1 memprof-context-disambiguation - Number of not cold static allocations (possibly cloned) 317cfad2d3aSTeresa Johnson; STATS-BE: 1 memprof-context-disambiguation - Number of not cold static allocations (possibly cloned) during ThinLTO backend 318cfad2d3aSTeresa Johnson; STATS-BE: 2 memprof-context-disambiguation - Number of allocation versions (including clones) during ThinLTO backend 31904f3c5a7STeresa Johnson; STATS: 3 memprof-context-disambiguation - Number of function clones created during whole program analysis 320cfad2d3aSTeresa Johnson; STATS-BE: 3 memprof-context-disambiguation - Number of function clones created during ThinLTO backend 321cfad2d3aSTeresa Johnson; STATS-BE: 3 memprof-context-disambiguation - Number of functions that had clones created during ThinLTO backend 322cfad2d3aSTeresa Johnson; STATS-BE: 2 memprof-context-disambiguation - Maximum number of allocation versions created for an original allocation during ThinLTO backend 323cfad2d3aSTeresa Johnson; STATS-BE: 1 memprof-context-disambiguation - Number of original (not cloned) allocations with memprof profiles during ThinLTO backend 32404f3c5a7STeresa Johnson 32504f3c5a7STeresa Johnson 326fe27495bSTeresa Johnson; DOT: digraph "postbuild" { 327fe27495bSTeresa Johnson; DOT: label="postbuild"; 328fe27495bSTeresa Johnson; DOT: Node[[BAR:0x[a-z0-9]+]] [shape=record,tooltip="N[[BAR]] ContextIds: 1 2",fillcolor="mediumorchid1",style="filled",style="filled",label="{OrigId: Alloc0\n_Z3barv -\> alloc}"]; 329fe27495bSTeresa Johnson; DOT: Node[[BAZ:0x[a-z0-9]+]] [shape=record,tooltip="N[[BAZ]] ContextIds: 1 2",fillcolor="mediumorchid1",style="filled",style="filled",label="{OrigId: 12481870273128938184\n_Z3bazv -\> _Z3barv}"]; 330fe27495bSTeresa Johnson; DOT: Node[[BAZ]] -> Node[[BAR]][tooltip="ContextIds: 1 2",fillcolor="mediumorchid1"]; 331fe27495bSTeresa Johnson; DOT: Node[[FOO:0x[a-z0-9]+]] [shape=record,tooltip="N[[FOO]] ContextIds: 1 2",fillcolor="mediumorchid1",style="filled",style="filled",label="{OrigId: 2732490490862098848\n_Z3foov -\> _Z3bazv}"]; 332fe27495bSTeresa Johnson; DOT: Node[[FOO]] -> Node[[BAZ]][tooltip="ContextIds: 1 2",fillcolor="mediumorchid1"]; 333fe27495bSTeresa Johnson; DOT: Node[[MAIN1:0x[a-z0-9]+]] [shape=record,tooltip="N[[MAIN1]] ContextIds: 1",fillcolor="brown1",style="filled",style="filled",label="{OrigId: 8632435727821051414\nmain -\> _Z3foov}"]; 334fe27495bSTeresa Johnson; DOT: Node[[MAIN1]] -> Node[[FOO]][tooltip="ContextIds: 1",fillcolor="brown1"]; 335fe27495bSTeresa Johnson; DOT: Node[[MAIN2:0x[a-z0-9]+]] [shape=record,tooltip="N[[MAIN2]] ContextIds: 2",fillcolor="cyan",style="filled",style="filled",label="{OrigId: 15025054523792398438\nmain -\> _Z3foov}"]; 336fe27495bSTeresa Johnson; DOT: Node[[MAIN2]] -> Node[[FOO]][tooltip="ContextIds: 2",fillcolor="cyan"]; 337fe27495bSTeresa Johnson; DOT: } 338a104e270STeresa Johnson 339a104e270STeresa Johnson 340a104e270STeresa Johnson; DOTCLONED: digraph "cloned" { 341a104e270STeresa Johnson; DOTCLONED: label="cloned"; 342a104e270STeresa Johnson; DOTCLONED: Node[[BAR:0x[a-z0-9]+]] [shape=record,tooltip="N[[BAR]] ContextIds: 1",fillcolor="brown1",style="filled",style="filled",label="{OrigId: Alloc0\n_Z3barv -\> alloc}"]; 343a104e270STeresa Johnson; DOTCLONED: Node[[BAZ:0x[a-z0-9]+]] [shape=record,tooltip="N[[BAZ]] ContextIds: 1",fillcolor="brown1",style="filled",style="filled",label="{OrigId: 12481870273128938184\n_Z3bazv -\> _Z3barv}"]; 344a104e270STeresa Johnson; DOTCLONED: Node[[BAZ]] -> Node[[BAR]][tooltip="ContextIds: 1",fillcolor="brown1"]; 345a104e270STeresa Johnson; DOTCLONED: Node[[FOO:0x[a-z0-9]+]] [shape=record,tooltip="N[[FOO]] ContextIds: 1",fillcolor="brown1",style="filled",style="filled",label="{OrigId: 2732490490862098848\n_Z3foov -\> _Z3bazv}"]; 346a104e270STeresa Johnson; DOTCLONED: Node[[FOO]] -> Node[[BAZ]][tooltip="ContextIds: 1",fillcolor="brown1"]; 347a104e270STeresa Johnson; DOTCLONED: Node[[MAIN1:0x[a-z0-9]+]] [shape=record,tooltip="N[[MAIN1]] ContextIds: 1",fillcolor="brown1",style="filled",style="filled",label="{OrigId: 8632435727821051414\nmain -\> _Z3foov}"]; 348a104e270STeresa Johnson; DOTCLONED: Node[[MAIN1]] -> Node[[FOO]][tooltip="ContextIds: 1",fillcolor="brown1"]; 349a104e270STeresa Johnson; DOTCLONED: Node[[MAIN2:0x[a-z0-9]+]] [shape=record,tooltip="N[[MAIN2]] ContextIds: 2",fillcolor="cyan",style="filled",style="filled",label="{OrigId: 15025054523792398438\nmain -\> _Z3foov}"]; 350a104e270STeresa Johnson; DOTCLONED: Node[[MAIN2]] -> Node[[FOO2:0x[a-z0-9]+]][tooltip="ContextIds: 2",fillcolor="cyan"]; 351a104e270STeresa Johnson; DOTCLONED: Node[[FOO2]] [shape=record,tooltip="N[[FOO2]] ContextIds: 2",fillcolor="cyan",style="filled",color="blue",style="filled,bold,dashed",label="{OrigId: 0\n_Z3foov -\> _Z3bazv}"]; 352a104e270STeresa Johnson; DOTCLONED: Node[[FOO2]] -> Node[[BAZ2:0x[a-z0-9]+]][tooltip="ContextIds: 2",fillcolor="cyan"]; 353a104e270STeresa Johnson; DOTCLONED: Node[[BAZ2]] [shape=record,tooltip="N[[BAZ2]] ContextIds: 2",fillcolor="cyan",style="filled",color="blue",style="filled,bold,dashed",label="{OrigId: 0\n_Z3bazv -\> _Z3barv}"]; 354a104e270STeresa Johnson; DOTCLONED: Node[[BAZ2]] -> Node[[BAR2:0x[a-z0-9]+]][tooltip="ContextIds: 2",fillcolor="cyan"]; 355a104e270STeresa Johnson; DOTCLONED: Node[[BAR2]] [shape=record,tooltip="N[[BAR2]] ContextIds: 2",fillcolor="cyan",style="filled",color="blue",style="filled,bold,dashed",label="{OrigId: Alloc0\n_Z3barv -\> alloc}"]; 356a104e270STeresa Johnson; DOTCLONED: } 35704f3c5a7STeresa Johnson 35804f3c5a7STeresa Johnson 35978a195e1SMingming Liu; DISTRIB: ^[[BAZ:[0-9]+]] = gv: (guid: 1807954217441101578, {{.*}} callsites: ((callee: ^[[BAR:[0-9]+]], clones: (0, 1) 36078a195e1SMingming Liu; DISTRIB: ^[[FOO:[0-9]+]] = gv: (guid: 8107868197919466657, {{.*}} callsites: ((callee: ^[[BAZ]], clones: (0, 1) 36178a195e1SMingming Liu; DISTRIB: ^[[BAR]] = gv: (guid: 11481133863268513686, {{.*}} allocs: ((versions: (notcold, cold) 36204f3c5a7STeresa Johnson; DISTRIB: ^[[MAIN:[0-9]+]] = gv: (guid: 15822663052811949562, {{.*}} callsites: ((callee: ^[[FOO]], clones: (0), {{.*}} (callee: ^[[FOO]], clones: (1) 363