[llvm] [memprof] Test the memprof-use pass with a YAML (PR #119779)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 12 14:42:08 PST 2024


================
@@ -0,0 +1,45 @@
+; Make sure that we can ingest the MemProf profile in YAML and
+; annotate a call to new as cold.
+
+; REQUIRES: x86_64-linux
+
+; RUN: split-file %s %t
+; RUN: llvm-profdata merge %t/memprof_annotate_yaml.yaml -o %t/memprof_annotate_yaml.memprofdata
+; RUN: opt < %t/memprof_annotate_yaml.ll -passes='memprof-use<profile-filename=%t/memprof_annotate_yaml.memprofdata>' -S 2>&1 | FileCheck %s
+
+;--- memprof_annotate_yaml.yaml
+---
+HeapProfileRecords:
+  - GUID:            _Z3foov
+    AllocSites:
+      - Callstack:
+          - { Function: _Z3foov, LineOffset: 0, Column: 22, IsInlineFrame: false }
+          - { Function: main, LineOffset: 2, Column: 5, IsInlineFrame: false }
+        MemInfoBlock:
+          TotalSize:                  400
----------------
kazutakahirata wrote:

Added the significance with a pointer to `MemoryProfileInfo.cpp`.

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


More information about the llvm-commits mailing list