48 lines · plain
1; REQUIRES: x86_64-linux2 3; Make sure that we can ingest the MemProf profile in YAML and4; annotate a call to new as cold.5 6; RUN: split-file %s %t7; RUN: llvm-profdata merge %t/memprof_annotate_yaml.yaml -o %t/memprof_annotate_yaml.memprofdata8; RUN: opt < %t/memprof_annotate_yaml.ll -passes='memprof-use<profile-filename=%t/memprof_annotate_yaml.memprofdata>' -S 2>&1 | FileCheck %s9 10;--- memprof_annotate_yaml.yaml11---12HeapProfileRecords:13 - GUID: _Z3foov14 AllocSites:15 - Callstack:16 - { Function: _Z3foov, LineOffset: 0, Column: 22, IsInlineFrame: false }17 - { Function: main, LineOffset: 2, Column: 5, IsInlineFrame: false }18 MemInfoBlock:19 # With these numbers, llvm::memprof::getAllocType will determine that20 # the call to new is cold. See MemoryProfileInfo.cpp for details.21 TotalSize: 40022 AllocCount: 123 TotalLifetimeAccessDensity: 124 TotalLifetime: 100000025 CallSites: []26...27;--- memprof_annotate_yaml.ll28define dso_local ptr @_Z3foov() !dbg !4 {29entry:30 %call = call ptr @_Znam(i64 4) #0, !dbg !531; CHECK: call ptr @_Znam(i64 4) #[[ATTR:[0-9]+]],32 ret ptr %call33}34 35declare ptr @_Znam(i64)36 37attributes #0 = { builtin allocsize(0) }38; CHECK: attributes #[[ATTR]] = {{.*}} "memprof"="cold"39 40!llvm.module.flags = !{!2, !3}41 42!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1)43!1 = !DIFile(filename: "t", directory: "/")44!2 = !{i32 7, !"Dwarf Version", i32 5}45!3 = !{i32 2, !"Debug Info Version", i32 3}46!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 1, unit: !0)47!5 = !DILocation(line: 1, column: 22, scope: !4)48