[llvm] [memprof] Undrift MemProfRecord (PR #120138)

Snehasish Kumar via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 18 10:52:26 PST 2024


================
@@ -0,0 +1,156 @@
+; REQUIRES: x86_64-linux
+
+; Make sure that we can undrift the MemProf profile and annotate the IR
+; accordingly.
+
+; RUN: split-file %s %t
+; RUN: llvm-profdata merge %t/memprof_undrift.yaml -o %t/memprof_undrift.memprofdata
+; RUN: opt < %t/memprof_undrift.ll -passes='memprof-use<profile-filename=%t/memprof_undrift.memprofdata>' -memprof-salvage-stale-profile -memprof-ave-lifetime-cold-threshold=5 -S 2>&1 | FileCheck %s
+
+;--- memprof_undrift.yaml
+---
+HeapProfileRecords:
+  - GUID:            _Z3aaav
+    AllocSites:      []
+    CallSites:
+      - - { Function: _Z3aaav, LineOffset: 5, Column: 33, IsInlineFrame: false }
+  - GUID:            _Z6middlev
+    AllocSites:      []
+    CallSites:
+      - - { Function: _Z6middlev, LineOffset: 5, Column: 33, IsInlineFrame: false }
+  - GUID:            _Z3foov
+    AllocSites:
+      - Callstack:
+          - { Function: _Z3foov, LineOffset: 5, Column: 33, IsInlineFrame: false }
+          - { Function: main, LineOffset: 5, Column: 33, IsInlineFrame: false }
+        MemInfoBlock:
+          AllocCount:      1
+          TotalSize:       4
+          TotalLifetime:   10000
+          TotalLifetimeAccessDensity: 0
+    CallSites:       []
+  - GUID:            _Z4leafv
+    AllocSites:
+      - Callstack:
+          - { Function: _Z4leafv, LineOffset: 5, Column: 33, IsInlineFrame: false }
+          - { Function: _Z6middlev, LineOffset: 5, Column: 33, IsInlineFrame: false }
+          - { Function: _Z3aaav, LineOffset: 5, Column: 33, IsInlineFrame: false }
+          - { Function: main, LineOffset: 5, Column: 33, IsInlineFrame: false }
+        MemInfoBlock:
+          AllocCount:      1
+          TotalSize:       4
+          TotalLifetime:   0
+          TotalLifetimeAccessDensity: 25000
+      - Callstack:
+          - { Function: _Z4leafv, LineOffset: 5, Column: 33, IsInlineFrame: false }
+          - { Function: _Z6middlev, LineOffset: 5, Column: 33, IsInlineFrame: false }
+          - { Function: _Z3bbbv, LineOffset: 5, Column: 33, IsInlineFrame: false }
+          - { Function: main, LineOffset: 5, Column: 33, IsInlineFrame: false }
+        MemInfoBlock:
+          AllocCount:      1
+          TotalSize:       4
+          TotalLifetime:   10000
+          TotalLifetimeAccessDensity: 2
+    CallSites:       []
+  - GUID:            _Z3bbbv
+    AllocSites:      []
+    CallSites:
+      - - { Function: _Z3bbbv, LineOffset: 5, Column: 33, IsInlineFrame: false }
+...
----------------
snehasish wrote:

Is this `...` part of the format?

https://github.com/llvm/llvm-project/pull/120138


More information about the llvm-commits mailing list