Skip to content

Commit 2af819f

Browse files
[MemProf] Add test for hot hints (#124394)
The change in PR124219 required removing one of the tests added for -memprof-use-hot-hints, since we no longer label any contexts as hot in metadata, so add a new test that checks the hot attribute instead.
1 parent 33ad474 commit 2af819f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

llvm/test/Transforms/PGOProfile/memprof.ll

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,14 @@
8585
; RAND2: random hotness seed = 1730170724
8686
; 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
8787

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+
8896
; MEMPROFMATCHINFO: MemProf notcold context with id 1093248920606587996 has total profiled size 10 is matched
8997
; MEMPROFMATCHINFO: MemProf notcold context with id 5725971306423925017 has total profiled size 10 is matched
9098
; MEMPROFMATCHINFO: MemProf notcold context with id 6792096022461663180 has total profiled size 10 is matched
@@ -192,6 +200,7 @@ entry:
192200
store ptr %argv, ptr %argv.addr, align 8
193201
; MEMPROF: call {{.*}} @_Znam{{.*}} #[[A1:[0-9]+]]
194202
; MEMPROFNOCOLINFO: call {{.*}} @_Znam{{.*}} #[[A1:[0-9]+]]
203+
; MEMPROFHOT: call {{.*}} @_Znam{{.*}} #[[A1:[0-9]+]]
195204
%call = call noalias noundef nonnull ptr @_Znam(i64 noundef 10) #6, !dbg !35
196205
store ptr %call, ptr %a, align 8, !dbg !36
197206
; MEMPROF: call {{.*}} @_Znam{{.*}} #[[A2:[0-9]+]]
@@ -404,6 +413,8 @@ for.end: ; preds = %for.cond
404413
; MEMPROFNOCOLINFO: ![[C10]] = !{i64 -4535090212904553409}
405414
; MEMPROFNOCOLINFO: ![[C11]] = !{i64 3577763375057267810}
406415

416+
; MEMPROFHOT: #[[A1]] = { builtin allocsize(0) "memprof"="hot" }
417+
407418
;; For the specific random seed, this is the expected order of hotness
408419
; MEMPROFRAND2: !"cold"
409420
; MEMPROFRAND2: !"cold"

0 commit comments

Comments
 (0)