1;; Tests memprof profile matching (with and without instrumentation profiles). 2 3;; Several requirements due to using raw profile inputs: 4;; PGO profile uses zlib compression 5; REQUIRES: zlib 6;; Avoid failures on big-endian systems that can't read the profile properly 7; REQUIRES: x86_64-linux 8;; -stats requires asserts 9; REQUIRES: asserts 10 11;; TODO: Use text profile inputs once that is available for memprof. 12;; # To update the Inputs below, run Inputs/update_memprof_inputs.sh. 13;; # To generate below LLVM IR for use in matching: 14;; $ clang++ -gmlt -fdebug-info-for-profiling -fno-omit-frame-pointer \ 15;; -fno-optimize-sibling-calls memprof.cc -S -emit-llvm 16 17;; Generate indexed profiles of all combinations: 18; RUN: llvm-profdata merge %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdata 19; RUN: llvm-profdata merge %S/Inputs/memprof_pgo.proftext %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.pgomemprofdata 20; RUN: llvm-profdata merge %S/Inputs/memprof_pgo.proftext -o %t.pgoprofdata 21; RUN: llvm-profdata merge %S/Inputs/memprof.nocolinfo.memprofraw --profiled-binary %S/Inputs/memprof.nocolinfo.exe -o %t.nocolinfo.memprofdata 22 23;; In all below cases we should not get any messages about missing profile data 24;; for any functions. Either we are not performing any matching for a particular 25;; profile type or we are performing the matching and it should be successful. 26; ALL-NOT: memprof record not found for function hash 27; ALL-NOT: no profile data available for function 28 29;; Using a memprof-only profile for memprof-use should only give memprof metadata 30; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdata>' -pgo-warn-missing-function -S -memprof-print-match-info -stats 2>&1 | FileCheck %s --check-prefixes=MEMPROF,ALL,MEMPROFONLY,MEMPROFMATCHINFO,MEMPROFSTATS 31; There should not be any PGO metadata 32; MEMPROFONLY-NOT: !prof 33 34;; Try again but using a profile with missing columns. The memprof matcher 35;; should recognize that there are no non-zero columns in the profile and 36;; not attempt to include column numbers in the matching (which means that the 37;; stack ids will be different). 38; RUN: opt < %s -passes='memprof-use<profile-filename=%t.nocolinfo.memprofdata>' -pgo-warn-missing-function -S 2>&1 | FileCheck %s --check-prefixes=MEMPROFNOCOLINFO,ALL,MEMPROFONLY 39 40;; Test the same thing but by passing the memory profile through to a default 41;; pipeline via -memory-profile-file=, which should cause the necessary field 42;; of the PGOOptions structure to be populated with the profile filename. 43; RUN: opt < %s -passes='default<O2>' -memory-profile-file=%t.memprofdata -pgo-warn-missing-function -S 2>&1 | FileCheck %s --check-prefixes=MEMPROF,ALL,MEMPROFONLY 44 45;; Using a pgo+memprof profile for memprof-use should only give memprof metadata 46; RUN: opt < %s -passes='memprof-use<profile-filename=%t.pgomemprofdata>' -pgo-warn-missing-function -S 2>&1 | FileCheck %s --check-prefixes=MEMPROF,ALL,MEMPROFONLY 47 48;; Using a pgo-only profile for memprof-use should give an error 49; RUN: not opt < %s -passes='memprof-use<profile-filename=%t.pgoprofdata>' -S 2>&1 | FileCheck %s --check-prefixes=MEMPROFWITHPGOONLY 50; MEMPROFWITHPGOONLY: Not a memory profile 51 52;; Using a memprof-only profile for pgo-instr-use should give an error 53; RUN: not opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.memprofdata -S 2>&1 | FileCheck %s --check-prefixes=PGOWITHMEMPROFONLY 54; PGOWITHMEMPROFONLY: Not an IR level instrumentation profile 55 56;; Using a pgo+memprof profile for pgo-instr-use should only give pgo metadata 57; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.pgomemprofdata -pgo-warn-missing-function -S 2>&1 | FileCheck %s --check-prefixes=PGO,ALL,PGOONLY 58; There should not be any memprof related metadata 59; PGOONLY-NOT: !memprof 60; PGOONLY-NOT: !callsite 61 62;; Using a pgo+memprof profile for both memprof-use and pgo-instr-use should 63;; give both memprof and pgo metadata. 64; RUN: opt < %s -passes='pgo-instr-use,memprof-use<profile-filename=%t.pgomemprofdata>' -pgo-test-profile-file=%t.pgomemprofdata -pgo-warn-missing-function -S 2>&1 | FileCheck %s --check-prefixes=MEMPROF,ALL,PGO 65 66;; Check that the total sizes are reported if requested. 67; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdata>' -pgo-warn-missing-function -S -memprof-report-hinted-sizes -memprof-keep-all-not-cold-contexts 2>&1 | FileCheck %s --check-prefixes=TOTALSIZESSINGLE,TOTALSIZES 68 69;; Check that we hint additional allocations with a threshold < 100% 70; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdata>' -pgo-warn-missing-function -S -memprof-report-hinted-sizes -memprof-matching-cold-threshold=60 2>&1 | FileCheck %s --check-prefixes=TOTALSIZESSINGLE,TOTALSIZESTHRESH60 71 72;; Make sure that the -memprof-cloning-cold-threshold flag is enough to cause 73;; the size metadata to be generated for the LTO link. 74; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdata>' -pgo-warn-missing-function -S -memprof-cloning-cold-threshold=80 -memprof-keep-all-not-cold-contexts 2>&1 | FileCheck %s --check-prefixes=TOTALSIZES 75 76;; Make sure we emit a random hotness seed if requested. 77; RUN: llvm-profdata merge -memprof-random-hotness %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand 2>&1 | FileCheck %s --check-prefix=RAND 78; RAND: random hotness seed = 79;; Can't check the exact values, but make sure applying the random profile 80;; succeeds with the same stats 81; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdatarand>' -pgo-warn-missing-function -S -stats 2>&1 | FileCheck %s --check-prefixes=ALL,MEMPROFONLY,MEMPROFSTATS 82 83;; Make sure we use a specific random hotness seed if requested. 84; RUN: llvm-profdata merge -memprof-random-hotness -memprof-random-hotness-seed=1730170724 %S/Inputs/memprof.memprofraw --profiled-binary %S/Inputs/memprof.exe -o %t.memprofdatarand2 2>&1 | FileCheck %s --check-prefix=RAND2 85; RAND2: random hotness seed = 1730170724 86; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdatarand2>' -pgo-warn-missing-function -S -stats 2>&1 | FileCheck %s --check-prefixes=MEMPROFRAND2,ALL,MEMPROFONLY,MEMPROFSTATS 87 88;; With the hot access density threshold set to 0, and hot hints enabled, 89;; the unconditionally notcold call to new should instead get a hot attribute. 90; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdata>' -pgo-warn-missing-function -S -memprof-print-match-info -stats -memprof-min-ave-lifetime-access-density-hot-threshold=0 -memprof-use-hot-hints 2>&1 | FileCheck %s --check-prefixes=MEMPROFHOT,ALL 91 92;; However, with the same threshold, but hot hints not enabled, it should be 93;; notcold again. 94; RUN: opt < %s -passes='memprof-use<profile-filename=%t.memprofdata>' -pgo-warn-missing-function -S -memprof-min-ave-lifetime-access-density-hot-threshold=0 2>&1 | FileCheck %s --check-prefixes=MEMPROF,ALL 95 96; MEMPROFMATCHINFO: MemProf notcold context with id 1093248920606587996 has total profiled size 10 is matched 97; MEMPROFMATCHINFO: MemProf notcold context with id 5725971306423925017 has total profiled size 10 is matched 98; MEMPROFMATCHINFO: MemProf notcold context with id 6792096022461663180 has total profiled size 10 is matched 99; MEMPROFMATCHINFO: MemProf cold context with id 8525406123785421946 has total profiled size 10 is matched 100; MEMPROFMATCHINFO: MemProf cold context with id 11714230664165068698 has total profiled size 10 is matched 101; MEMPROFMATCHINFO: MemProf cold context with id 15737101490731057601 has total profiled size 10 is matched 102; MEMPROFMATCHINFO: MemProf cold context with id 16342802530253093571 has total profiled size 10 is matched 103; MEMPROFMATCHINFO: MemProf cold context with id 18254812774972004394 has total profiled size 10 is matched 104 105; ModuleID = 'memprof.cc' 106source_filename = "memprof.cc" 107target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 108target triple = "x86_64-unknown-linux-gnu" 109 110; Function Attrs: mustprogress noinline optnone uwtable 111; ALL-LABEL: define dso_local noundef{{.*}}ptr @_Z3foov() 112; There should be some PGO metadata 113; PGO: !prof 114define dso_local noundef ptr @_Z3foov() #0 !dbg !10 { 115entry: 116 ; MEMPROF: call {{.*}} @_Znam{{.*}} !memprof ![[M1:[0-9]+]], !callsite ![[C1:[0-9]+]] 117 ; MEMPROFNOCOLINFO: call {{.*}} @_Znam{{.*}} !memprof ![[M1:[0-9]+]], !callsite ![[C1:[0-9]+]] 118 %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #6, !dbg !13 119 ret ptr %call, !dbg !14 120} 121 122; Function Attrs: nobuiltin allocsize(0) 123declare noundef nonnull ptr @_Znam(i64 noundef) #1 124 125; Function Attrs: mustprogress noinline optnone uwtable 126; ALL-LABEL: define dso_local noundef{{.*}}ptr @_Z4foo2v() 127define dso_local noundef ptr @_Z4foo2v() #0 !dbg !15 { 128entry: 129 ; MEMPROF: call {{.*}} @_Z3foov{{.*}} !callsite ![[C2:[0-9]+]] 130 ; MEMPROFNOCOLINFO: call {{.*}} @_Z3foov{{.*}} !callsite ![[C2:[0-9]+]] 131 %call = call noundef ptr @_Z3foov(), !dbg !16 132 ret ptr %call, !dbg !17 133} 134 135; Function Attrs: mustprogress noinline optnone uwtable 136define dso_local noundef ptr @_Z3barv() #0 !dbg !18 { 137entry: 138 ; MEMPROF: call {{.*}} @_Z4foo2v{{.*}} !callsite ![[C3:[0-9]+]] 139 ; MEMPROFNOCOLINFO: call {{.*}} @_Z4foo2v{{.*}} !callsite ![[C3:[0-9]+]] 140 %call = call noundef ptr @_Z4foo2v(), !dbg !19 141 ret ptr %call, !dbg !20 142} 143 144; Function Attrs: mustprogress noinline optnone uwtable 145define dso_local noundef ptr @_Z3bazv() #0 !dbg !21 { 146entry: 147 ; MEMPROF: call {{.*}} @_Z4foo2v{{.*}} !callsite ![[C4:[0-9]+]] 148 ; MEMPROFNOCOLINFO: call {{.*}} @_Z4foo2v{{.*}} !callsite ![[C4:[0-9]+]] 149 %call = call noundef ptr @_Z4foo2v(), !dbg !22 150 ret ptr %call, !dbg !23 151} 152 153; Function Attrs: mustprogress noinline optnone uwtable 154define dso_local noundef ptr @_Z7recursej(i32 noundef %n) #0 !dbg !24 { 155entry: 156 %retval = alloca ptr, align 8 157 %n.addr = alloca i32, align 4 158 store i32 %n, ptr %n.addr, align 4 159 %0 = load i32, ptr %n.addr, align 4, !dbg !25 160 %tobool = icmp ne i32 %0, 0, !dbg !25 161 br i1 %tobool, label %if.end, label %if.then, !dbg !26 162 163if.then: ; preds = %entry 164 ; MEMPROF: call {{.*}} @_Z3foov{{.*}} !callsite ![[C5:[0-9]+]] 165 ; MEMPROFNOCOLINFO: call {{.*}} @_Z3foov{{.*}} !callsite ![[C5:[0-9]+]] 166 %call = call noundef ptr @_Z3foov(), !dbg !27 167 store ptr %call, ptr %retval, align 8, !dbg !28 168 br label %return, !dbg !28 169 170if.end: ; preds = %entry 171 %1 = load i32, ptr %n.addr, align 4, !dbg !29 172 %sub = sub i32 %1, 1, !dbg !30 173 ; MEMPROF: call {{.*}} @_Z7recursej{{.*}} !callsite ![[C6:[0-9]+]] 174 ; MEMPROFNOCOLINFO: call {{.*}} @_Z7recursej{{.*}} !callsite ![[C6:[0-9]+]] 175 %call1 = call noundef ptr @_Z7recursej(i32 noundef %sub), !dbg !31 176 store ptr %call1, ptr %retval, align 8, !dbg !32 177 br label %return, !dbg !32 178 179return: ; preds = %if.end, %if.then 180 %2 = load ptr, ptr %retval, align 8, !dbg !33 181 ret ptr %2, !dbg !33 182} 183 184; Function Attrs: mustprogress noinline norecurse optnone uwtable 185define dso_local noundef i32 @main(i32 noundef %argc, ptr noundef %argv) #2 !dbg !34 { 186entry: 187 %retval = alloca i32, align 4 188 %argc.addr = alloca i32, align 4 189 %argv.addr = alloca ptr, align 8 190 %a = alloca ptr, align 8 191 %b = alloca ptr, align 8 192 %c = alloca ptr, align 8 193 %d = alloca ptr, align 8 194 %e = alloca ptr, align 8 195 %f = alloca ptr, align 8 196 %i = alloca i32, align 4 197 %g = alloca ptr, align 8 198 store i32 0, ptr %retval, align 4 199 store i32 %argc, ptr %argc.addr, align 4 200 store ptr %argv, ptr %argv.addr, align 8 201 ; MEMPROF: call {{.*}} @_Znam{{.*}} #[[A1:[0-9]+]] 202 ; MEMPROFNOCOLINFO: call {{.*}} @_Znam{{.*}} #[[A1:[0-9]+]] 203 ; MEMPROFHOT: call {{.*}} @_Znam{{.*}} #[[A1:[0-9]+]] 204 %call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #6, !dbg !35 205 store ptr %call, ptr %a, align 8, !dbg !36 206 ; MEMPROF: call {{.*}} @_Znam{{.*}} #[[A2:[0-9]+]] 207 ; MEMPROFNOCOLINFO: call {{.*}} @_Znam{{.*}} #[[A2:[0-9]+]] 208 %call1 = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #6, !dbg !37 209 store ptr %call1, ptr %b, align 8, !dbg !38 210 ; MEMPROF: call {{.*}} @_Z3foov{{.*}} !callsite ![[C7:[0-9]+]] 211 ; MEMPROFNOCOLINFO: call {{.*}} @_Z3foov{{.*}} !callsite ![[C7:[0-9]+]] 212 %call2 = call noundef ptr @_Z3foov(), !dbg !39 213 store ptr %call2, ptr %c, align 8, !dbg !40 214 ; MEMPROF: call {{.*}} @_Z3foov{{.*}} !callsite ![[C8:[0-9]+]] 215 ; MEMPROFNOCOLINFO: call {{.*}} @_Z3foov{{.*}} !callsite ![[C8:[0-9]+]] 216 %call3 = call noundef ptr @_Z3foov(), !dbg !41 217 store ptr %call3, ptr %d, align 8, !dbg !42 218 ; MEMPROF: call {{.*}} @_Z3barv{{.*}} !callsite ![[C9:[0-9]+]] 219 ; MEMPROFNOCOLINFO: call {{.*}} @_Z3barv{{.*}} !callsite ![[C9:[0-9]+]] 220 %call4 = call noundef ptr @_Z3barv(), !dbg !43 221 store ptr %call4, ptr %e, align 8, !dbg !44 222 ; MEMPROF: call {{.*}} @_Z3bazv{{.*}} !callsite ![[C10:[0-9]+]] 223 ; MEMPROFNOCOLINFO: call {{.*}} @_Z3bazv{{.*}} !callsite ![[C10:[0-9]+]] 224 %call5 = call noundef ptr @_Z3bazv(), !dbg !45 225 store ptr %call5, ptr %f, align 8, !dbg !46 226 %0 = load ptr, ptr %a, align 8, !dbg !47 227 call void @llvm.memset.p0.i64(ptr align 1 %0, i8 0, i64 10, i1 false), !dbg !48 228 %1 = load ptr, ptr %b, align 8, !dbg !49 229 call void @llvm.memset.p0.i64(ptr align 1 %1, i8 0, i64 10, i1 false), !dbg !50 230 %2 = load ptr, ptr %c, align 8, !dbg !51 231 call void @llvm.memset.p0.i64(ptr align 1 %2, i8 0, i64 10, i1 false), !dbg !52 232 %3 = load ptr, ptr %d, align 8, !dbg !53 233 call void @llvm.memset.p0.i64(ptr align 1 %3, i8 0, i64 10, i1 false), !dbg !54 234 %4 = load ptr, ptr %e, align 8, !dbg !55 235 call void @llvm.memset.p0.i64(ptr align 1 %4, i8 0, i64 10, i1 false), !dbg !56 236 %5 = load ptr, ptr %f, align 8, !dbg !57 237 call void @llvm.memset.p0.i64(ptr align 1 %5, i8 0, i64 10, i1 false), !dbg !58 238 %6 = load ptr, ptr %a, align 8, !dbg !59 239 %isnull = icmp eq ptr %6, null, !dbg !60 240 br i1 %isnull, label %delete.end, label %delete.notnull, !dbg !60 241 242delete.notnull: ; preds = %entry 243 call void @_ZdaPv(ptr noundef %6) #7, !dbg !61 244 br label %delete.end, !dbg !61 245 246delete.end: ; preds = %delete.notnull, %entry 247 %7 = load ptr, ptr %c, align 8, !dbg !63 248 %isnull6 = icmp eq ptr %7, null, !dbg !64 249 br i1 %isnull6, label %delete.end8, label %delete.notnull7, !dbg !64 250 251delete.notnull7: ; preds = %delete.end 252 call void @_ZdaPv(ptr noundef %7) #7, !dbg !65 253 br label %delete.end8, !dbg !65 254 255delete.end8: ; preds = %delete.notnull7, %delete.end 256 %call9 = call i32 @sleep(i32 noundef 200), !dbg !66 257 %8 = load ptr, ptr %b, align 8, !dbg !67 258 %isnull10 = icmp eq ptr %8, null, !dbg !68 259 br i1 %isnull10, label %delete.end12, label %delete.notnull11, !dbg !68 260 261delete.notnull11: ; preds = %delete.end8 262 call void @_ZdaPv(ptr noundef %8) #7, !dbg !69 263 br label %delete.end12, !dbg !69 264 265delete.end12: ; preds = %delete.notnull11, %delete.end8 266 %9 = load ptr, ptr %d, align 8, !dbg !70 267 %isnull13 = icmp eq ptr %9, null, !dbg !71 268 br i1 %isnull13, label %delete.end15, label %delete.notnull14, !dbg !71 269 270delete.notnull14: ; preds = %delete.end12 271 call void @_ZdaPv(ptr noundef %9) #7, !dbg !72 272 br label %delete.end15, !dbg !72 273 274delete.end15: ; preds = %delete.notnull14, %delete.end12 275 %10 = load ptr, ptr %e, align 8, !dbg !73 276 %isnull16 = icmp eq ptr %10, null, !dbg !74 277 br i1 %isnull16, label %delete.end18, label %delete.notnull17, !dbg !74 278 279delete.notnull17: ; preds = %delete.end15 280 call void @_ZdaPv(ptr noundef %10) #7, !dbg !75 281 br label %delete.end18, !dbg !75 282 283delete.end18: ; preds = %delete.notnull17, %delete.end15 284 %11 = load ptr, ptr %f, align 8, !dbg !76 285 %isnull19 = icmp eq ptr %11, null, !dbg !77 286 br i1 %isnull19, label %delete.end21, label %delete.notnull20, !dbg !77 287 288delete.notnull20: ; preds = %delete.end18 289 call void @_ZdaPv(ptr noundef %11) #7, !dbg !78 290 br label %delete.end21, !dbg !78 291 292delete.end21: ; preds = %delete.notnull20, %delete.end18 293 store i32 0, ptr %i, align 4, !dbg !79 294 br label %for.cond, !dbg !80 295 296for.cond: ; preds = %for.inc, %delete.end21 297 %12 = load i32, ptr %i, align 4, !dbg !81 298 %cmp = icmp ult i32 %12, 2, !dbg !82 299 br i1 %cmp, label %for.body, label %for.end, !dbg !83 300 301for.body: ; preds = %for.cond 302 %13 = load i32, ptr %i, align 4, !dbg !84 303 %add = add i32 %13, 3, !dbg !85 304 ; MEMPROF: call {{.*}} @_Z7recursej{{.*}} !callsite ![[C11:[0-9]+]] 305 ; MEMPROFNOCOLINFO: call {{.*}} @_Z7recursej{{.*}} !callsite ![[C11:[0-9]+]] 306 %call22 = call noundef ptr @_Z7recursej(i32 noundef %add), !dbg !86 307 store ptr %call22, ptr %g, align 8, !dbg !87 308 %14 = load ptr, ptr %g, align 8, !dbg !88 309 call void @llvm.memset.p0.i64(ptr align 1 %14, i8 0, i64 10, i1 false), !dbg !89 310 %15 = load i32, ptr %i, align 4, !dbg !90 311 %tobool = icmp ne i32 %15, 0, !dbg !90 312 br i1 %tobool, label %if.end, label %if.then, !dbg !91 313 314if.then: ; preds = %for.body 315 %call23 = call i32 @sleep(i32 noundef 200), !dbg !92 316 br label %if.end, !dbg !92 317 318if.end: ; preds = %if.then, %for.body 319 %16 = load ptr, ptr %g, align 8, !dbg !93 320 %isnull24 = icmp eq ptr %16, null, !dbg !94 321 br i1 %isnull24, label %delete.end26, label %delete.notnull25, !dbg !94 322 323delete.notnull25: ; preds = %if.end 324 call void @_ZdaPv(ptr noundef %16) #7, !dbg !95 325 br label %delete.end26, !dbg !95 326 327delete.end26: ; preds = %delete.notnull25, %if.end 328 br label %for.inc, !dbg !96 329 330for.inc: ; preds = %delete.end26 331 %17 = load i32, ptr %i, align 4, !dbg !97 332 %inc = add i32 %17, 1, !dbg !97 333 store i32 %inc, ptr %i, align 4, !dbg !97 334 br label %for.cond, !dbg !99, !llvm.loop !100 335 336for.end: ; preds = %for.cond 337 ret i32 0, !dbg !103 338} 339 340; MEMPROF: #[[A1]] = { builtin allocsize(0) "memprof"="notcold" } 341; MEMPROF: #[[A2]] = { builtin allocsize(0) "memprof"="cold" } 342; MEMPROF: ![[M1]] = !{![[MIB1:[0-9]+]], ![[MIB2:[0-9]+]], ![[MIB3:[0-9]+]], ![[MIB4:[0-9]+]]} 343; MEMPROF: ![[MIB1]] = !{![[STACK1:[0-9]+]], !"cold"} 344; MEMPROF: ![[STACK1]] = !{i64 2732490490862098848, i64 748269490701775343} 345; MEMPROF: ![[MIB2]] = !{![[STACK2:[0-9]+]], !"cold"} 346; MEMPROF: ![[STACK2]] = !{i64 2732490490862098848, i64 2104812325165620841, i64 6281715513834610934, i64 6281715513834610934, i64 6281715513834610934, i64 1544787832369987002} 347; MEMPROF: ![[MIB3]] = !{![[STACK3:[0-9]+]], !"notcold"} 348; MEMPROF: ![[STACK3]] = !{i64 2732490490862098848, i64 2104812325165620841, i64 6281715513834610934, i64 6281715513834610934, i64 6281715513834610934, i64 6281715513834610934} 349; MEMPROF: ![[MIB4]] = !{![[STACK4:[0-9]+]], !"cold"} 350; MEMPROF: ![[STACK4]] = !{i64 2732490490862098848, i64 8467819354083268568} 351; MEMPROF: ![[C1]] = !{i64 2732490490862098848} 352; MEMPROF: ![[C2]] = !{i64 8467819354083268568} 353; MEMPROF: ![[C3]] = !{i64 9086428284934609951} 354; MEMPROF: ![[C4]] = !{i64 -5964873800580613432} 355; MEMPROF: ![[C5]] = !{i64 2104812325165620841} 356; MEMPROF: ![[C6]] = !{i64 6281715513834610934} 357; MEMPROF: ![[C7]] = !{i64 8690657650969109624} 358; MEMPROF: ![[C8]] = !{i64 748269490701775343} 359; MEMPROF: ![[C9]] = !{i64 -5747251260480066785} 360; MEMPROF: ![[C10]] = !{i64 2061451396820446691} 361; MEMPROF: ![[C11]] = !{i64 1544787832369987002} 362 363;; For non-context sensitive allocations that get attributes we emit a message 364;; with the full allocation context hash, type, and size in bytes. 365; TOTALSIZESTHRESH60: Total size for full allocation context hash 8525406123785421946 and dominant alloc type cold: 10 366; TOTALSIZESTHRESH60: Total size for full allocation context hash 11714230664165068698 and dominant alloc type cold: 10 367; TOTALSIZESTHRESH60: Total size for full allocation context hash 5725971306423925017 and dominant alloc type cold: 10 368; TOTALSIZESTHRESH60: Total size for full allocation context hash 16342802530253093571 and dominant alloc type cold: 10 369; TOTALSIZESTHRESH60: Total size for full allocation context hash 18254812774972004394 and dominant alloc type cold: 10 370; TOTALSIZESTHRESH60: Total size for full allocation context hash 1093248920606587996 and dominant alloc type cold: 10 371; TOTALSIZESSINGLE: Total size for full allocation context hash 6792096022461663180 and single alloc type notcold: 10 372; TOTALSIZESSINGLE: Total size for full allocation context hash 15737101490731057601 and single alloc type cold: 10 373;; For context sensitive allocations the full context hash and size in bytes 374;; are in separate metadata nodes included on the MIB metadata. 375; TOTALSIZES: !"cold", ![[CONTEXT1:[0-9]+]]} 376; TOTALSIZES: ![[CONTEXT1]] = !{i64 8525406123785421946, i64 10} 377; TOTALSIZES: !"cold", ![[CONTEXT2:[0-9]+]]} 378; TOTALSIZES: ![[CONTEXT2]] = !{i64 -6732513409544482918, i64 10} 379; TOTALSIZES: !"notcold", ![[CONTEXT3:[0-9]+]]} 380; TOTALSIZES: ![[CONTEXT3]] = !{i64 5725971306423925017, i64 10} 381;; There can be more than one context id / size pair due to context trimming 382;; when we match. 383; TOTALSIZES: !"cold", ![[CONTEXT4:[0-9]+]], ![[CONTEXT5:[0-9]+]]} 384; TOTALSIZES: ![[CONTEXT4]] = !{i64 -2103941543456458045, i64 10} 385; TOTALSIZES: ![[CONTEXT5]] = !{i64 -191931298737547222, i64 10} 386; TOTALSIZES: !"notcold", ![[CONTEXT6:[0-9]+]]} 387; TOTALSIZES: ![[CONTEXT6]] = !{i64 1093248920606587996, i64 10} 388 389; MEMPROFNOCOLINFO: #[[A1]] = { builtin allocsize(0) "memprof"="notcold" } 390; MEMPROFNOCOLINFO: #[[A2]] = { builtin allocsize(0) "memprof"="cold" } 391; MEMPROFNOCOLINFO: ![[M1]] = !{![[MIB1:[0-9]+]], ![[MIB2:[0-9]+]], ![[MIB3:[0-9]+]], ![[MIB4:[0-9]+]]} 392; MEMPROFNOCOLINFO: ![[MIB1]] = !{![[STACK1:[0-9]+]], !"cold"} 393; MEMPROFNOCOLINFO: ![[STACK1]] = !{i64 5281664982037379640, i64 6362220161075421157, i64 -5772587307814069790, i64 -5772587307814069790, i64 -5772587307814069790, i64 3577763375057267810} 394; MEMPROFNOCOLINFO: ![[MIB2]] = !{![[STACK2:[0-9]+]], !"notcold"} 395; MEMPROFNOCOLINFO: ![[STACK2]] = !{i64 5281664982037379640, i64 6362220161075421157, i64 -5772587307814069790, i64 -5772587307814069790, i64 -5772587307814069790, i64 -5772587307814069790} 396; MEMPROFNOCOLINFO: ![[MIB3]] = !{![[STACK3:[0-9]+]], !"cold"} 397; MEMPROFNOCOLINFO: ![[STACK3]] = !{i64 5281664982037379640, i64 -6871734214936418908} 398; MEMPROFNOCOLINFO: ![[MIB4]] = !{![[STACK4:[0-9]+]], !"cold"} 399; MEMPROFNOCOLINFO: ![[STACK4]] = !{i64 5281664982037379640, i64 -6201180255894224618} 400; MEMPROFNOCOLINFO: ![[C1]] = !{i64 5281664982037379640} 401; MEMPROFNOCOLINFO: ![[C2]] = !{i64 -6871734214936418908} 402; MEMPROFNOCOLINFO: ![[C3]] = !{i64 -5588766871448036195} 403; MEMPROFNOCOLINFO: ![[C4]] = !{i64 -8990226808646054327} 404; MEMPROFNOCOLINFO: ![[C5]] = !{i64 6362220161075421157} 405; MEMPROFNOCOLINFO: ![[C6]] = !{i64 -5772587307814069790} 406; MEMPROFNOCOLINFO: ![[C7]] = !{i64 -6896091699916449732} 407; MEMPROFNOCOLINFO: ![[C8]] = !{i64 -6201180255894224618} 408; MEMPROFNOCOLINFO: ![[C9]] = !{i64 -962804290746547393} 409; MEMPROFNOCOLINFO: ![[C10]] = !{i64 -4535090212904553409} 410; MEMPROFNOCOLINFO: ![[C11]] = !{i64 3577763375057267810} 411 412; MEMPROFHOT: #[[A1]] = { builtin allocsize(0) "memprof"="hot" } 413 414;; For the specific random seed, this is the expected order of hotness 415; MEMPROFRAND2: !"cold" 416; MEMPROFRAND2: !"cold" 417; MEMPROFRAND2: !"cold" 418; MEMPROFRAND2: !"notcold" 419 420; MEMPROFSTATS: 8 memprof - Number of alloc contexts in memory profile. 421; MEMPROFSTATS: 10 memprof - Number of callsites in memory profile. 422; MEMPROFSTATS: 6 memprof - Number of functions having valid memory profile. 423; MEMPROFSTATS: 8 memprof - Number of matched memory profile alloc contexts. 424; MEMPROFSTATS: 3 memprof - Number of matched memory profile allocs. 425; MEMPROFSTATS: 10 memprof - Number of matched memory profile callsites. 426 427 428; Function Attrs: argmemonly nofree nounwind willreturn writeonly 429declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #3 430 431; Function Attrs: nobuiltin nounwind 432declare void @_ZdaPv(ptr noundef) #4 433 434declare i32 @sleep(i32 noundef) #5 435 436attributes #0 = { mustprogress noinline optnone uwtable "disable-tail-calls"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } 437attributes #1 = { nobuiltin allocsize(0) "disable-tail-calls"="true" "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } 438attributes #2 = { mustprogress noinline norecurse optnone uwtable "disable-tail-calls"="true" "frame-pointer"="all" "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } 439attributes #3 = { argmemonly nofree nounwind willreturn writeonly } 440attributes #4 = { nobuiltin nounwind "disable-tail-calls"="true" "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } 441attributes #5 = { "disable-tail-calls"="true" "frame-pointer"="all" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" } 442attributes #6 = { builtin allocsize(0) } 443attributes #7 = { builtin nounwind } 444 445!llvm.dbg.cu = !{!0} 446!llvm.module.flags = !{!2, !3, !4, !5, !6, !7, !8} 447!llvm.ident = !{!9} 448 449!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 15.0.0 (https://github.com/llvm/llvm-project.git 6cbe6284d1f0a088b5c6482ae27b738f03d82fe7)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None) 450!1 = !DIFile(filename: "memprof.cc", directory: "/usr/local/google/home/tejohnson/llvm/tmp", checksumkind: CSK_MD5, checksum: "e8c40ebe4b21776b4d60e9632cbc13c2") 451!2 = !{i32 7, !"Dwarf Version", i32 5} 452!3 = !{i32 2, !"Debug Info Version", i32 3} 453!4 = !{i32 1, !"wchar_size", i32 4} 454!5 = !{i32 7, !"PIC Level", i32 2} 455!6 = !{i32 7, !"PIE Level", i32 2} 456!7 = !{i32 7, !"uwtable", i32 2} 457!8 = !{i32 7, !"frame-pointer", i32 2} 458!9 = !{!"clang version 15.0.0 (https://github.com/llvm/llvm-project.git 6cbe6284d1f0a088b5c6482ae27b738f03d82fe7)"} 459!10 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12) 460!11 = !DISubroutineType(types: !12) 461!12 = !{} 462!13 = !DILocation(line: 5, column: 10, scope: !10) 463!14 = !DILocation(line: 5, column: 3, scope: !10) 464!15 = distinct !DISubprogram(name: "foo2", linkageName: "_Z4foo2v", scope: !1, file: !1, line: 7, type: !11, scopeLine: 7, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12) 465!16 = !DILocation(line: 8, column: 10, scope: !15) 466!17 = !DILocation(line: 8, column: 3, scope: !15) 467!18 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 10, type: !11, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12) 468!19 = !DILocation(line: 11, column: 10, scope: !18) 469!20 = !DILocation(line: 11, column: 3, scope: !18) 470!21 = distinct !DISubprogram(name: "baz", linkageName: "_Z3bazv", scope: !1, file: !1, line: 13, type: !11, scopeLine: 13, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12) 471!22 = !DILocation(line: 14, column: 10, scope: !21) 472!23 = !DILocation(line: 14, column: 3, scope: !21) 473!24 = distinct !DISubprogram(name: "recurse", linkageName: "_Z7recursej", scope: !1, file: !1, line: 16, type: !11, scopeLine: 16, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12) 474!25 = !DILocation(line: 17, column: 8, scope: !24) 475!26 = !DILocation(line: 17, column: 7, scope: !24) 476!27 = !DILocation(line: 18, column: 12, scope: !24) 477!28 = !DILocation(line: 18, column: 5, scope: !24) 478!29 = !DILocation(line: 19, column: 18, scope: !24) 479!30 = !DILocation(line: 19, column: 19, scope: !24) 480!31 = !DILocation(line: 19, column: 10, scope: !24) 481!32 = !DILocation(line: 19, column: 3, scope: !24) 482!33 = !DILocation(line: 20, column: 1, scope: !24) 483!34 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 21, type: !11, scopeLine: 21, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !12) 484!35 = !DILocation(line: 25, column: 13, scope: !34) 485!36 = !DILocation(line: 25, column: 9, scope: !34) 486!37 = !DILocation(line: 26, column: 13, scope: !34) 487!38 = !DILocation(line: 26, column: 9, scope: !34) 488!39 = !DILocation(line: 27, column: 13, scope: !34) 489!40 = !DILocation(line: 27, column: 9, scope: !34) 490!41 = !DILocation(line: 28, column: 13, scope: !34) 491!42 = !DILocation(line: 28, column: 9, scope: !34) 492!43 = !DILocation(line: 29, column: 13, scope: !34) 493!44 = !DILocation(line: 29, column: 9, scope: !34) 494!45 = !DILocation(line: 30, column: 13, scope: !34) 495!46 = !DILocation(line: 30, column: 9, scope: !34) 496!47 = !DILocation(line: 31, column: 10, scope: !34) 497!48 = !DILocation(line: 31, column: 3, scope: !34) 498!49 = !DILocation(line: 32, column: 10, scope: !34) 499!50 = !DILocation(line: 32, column: 3, scope: !34) 500!51 = !DILocation(line: 33, column: 10, scope: !34) 501!52 = !DILocation(line: 33, column: 3, scope: !34) 502!53 = !DILocation(line: 34, column: 10, scope: !34) 503!54 = !DILocation(line: 34, column: 3, scope: !34) 504!55 = !DILocation(line: 35, column: 10, scope: !34) 505!56 = !DILocation(line: 35, column: 3, scope: !34) 506!57 = !DILocation(line: 36, column: 10, scope: !34) 507!58 = !DILocation(line: 36, column: 3, scope: !34) 508!59 = !DILocation(line: 38, column: 12, scope: !34) 509!60 = !DILocation(line: 38, column: 3, scope: !34) 510!61 = !DILocation(line: 38, column: 3, scope: !62) 511!62 = !DILexicalBlockFile(scope: !34, file: !1, discriminator: 2) 512!63 = !DILocation(line: 39, column: 12, scope: !34) 513!64 = !DILocation(line: 39, column: 3, scope: !34) 514!65 = !DILocation(line: 39, column: 3, scope: !62) 515!66 = !DILocation(line: 41, column: 3, scope: !34) 516!67 = !DILocation(line: 42, column: 12, scope: !34) 517!68 = !DILocation(line: 42, column: 3, scope: !34) 518!69 = !DILocation(line: 42, column: 3, scope: !62) 519!70 = !DILocation(line: 43, column: 12, scope: !34) 520!71 = !DILocation(line: 43, column: 3, scope: !34) 521!72 = !DILocation(line: 43, column: 3, scope: !62) 522!73 = !DILocation(line: 44, column: 12, scope: !34) 523!74 = !DILocation(line: 44, column: 3, scope: !34) 524!75 = !DILocation(line: 44, column: 3, scope: !62) 525!76 = !DILocation(line: 45, column: 12, scope: !34) 526!77 = !DILocation(line: 45, column: 3, scope: !34) 527!78 = !DILocation(line: 45, column: 3, scope: !62) 528!79 = !DILocation(line: 51, column: 17, scope: !34) 529!80 = !DILocation(line: 51, column: 8, scope: !34) 530!81 = !DILocation(line: 51, column: 24, scope: !62) 531!82 = !DILocation(line: 51, column: 26, scope: !62) 532!83 = !DILocation(line: 51, column: 3, scope: !62) 533!84 = !DILocation(line: 52, column: 23, scope: !34) 534!85 = !DILocation(line: 52, column: 25, scope: !34) 535!86 = !DILocation(line: 52, column: 15, scope: !34) 536!87 = !DILocation(line: 52, column: 11, scope: !34) 537!88 = !DILocation(line: 53, column: 12, scope: !34) 538!89 = !DILocation(line: 53, column: 5, scope: !34) 539!90 = !DILocation(line: 54, column: 10, scope: !34) 540!91 = !DILocation(line: 54, column: 9, scope: !34) 541!92 = !DILocation(line: 55, column: 7, scope: !34) 542!93 = !DILocation(line: 56, column: 14, scope: !34) 543!94 = !DILocation(line: 56, column: 5, scope: !34) 544!95 = !DILocation(line: 56, column: 5, scope: !62) 545!96 = !DILocation(line: 57, column: 3, scope: !34) 546!97 = !DILocation(line: 51, column: 32, scope: !98) 547!98 = !DILexicalBlockFile(scope: !34, file: !1, discriminator: 4) 548!99 = !DILocation(line: 51, column: 3, scope: !98) 549!100 = distinct !{!100, !101, !96, !102} 550!101 = !DILocation(line: 51, column: 3, scope: !34) 551!102 = !{!"llvm.loop.mustprogress"} 552!103 = !DILocation(line: 58, column: 3, scope: !34) 553