File: memprof-call-site-at-alloc-site.ll

package info (click to toggle)
llvm-toolchain-21 1%3A21.1.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,245,028 kB
  • sloc: cpp: 7,619,726; ansic: 1,434,018; asm: 1,058,748; python: 252,740; f90: 94,671; objc: 70,685; lisp: 42,813; pascal: 18,401; sh: 8,601; ml: 5,111; perl: 4,720; makefile: 3,675; awk: 3,523; javascript: 2,409; xml: 892; fortran: 770
file content (53 lines) | stat: -rw-r--r-- 2,010 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
; Verifies that a call site gets annotated even when a call site matches an
; allocation call stack but does not call one of the memory allocation
; functions.

; REQUIRES: x86_64-linux
; RUN: split-file %s %t
; RUN: llvm-profdata merge %t/memprof-call-site-at-alloc-site.yaml -o %t/memprof-call-site-at-alloc-site.memprofdata
; RUN: opt < %t/memprof-call-site-at-alloc-site.ll -passes='memprof-use<profile-filename=%t/memprof-call-site-at-alloc-site.memprofdata>' -memprof-print-match-info -S 2>&1 | FileCheck %s

;--- memprof-call-site-at-alloc-site.yaml
---
HeapProfileRecords:
  - GUID:            _Z3foov
    AllocSites:
      - Callstack:
          - { Function: _Z3foov, LineOffset: 6, Column: 12, IsInlineFrame: false }
        MemInfoBlock:
          AllocCount:      1
          TotalSize:       898709270
          TotalLifetime:   1000000
          TotalLifetimeAccessDensity: 1
    CallSites:
      - Frames:
        - { Function: _Z3foov, LineOffset: 6, Column: 12, IsInlineFrame: false }
...

;--- memprof-call-site-at-alloc-site.ll
; CHECK: MemProf callsite match for inline call stack 774294594974568741

target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-grtev4-linux-gnu"

declare void @_ZN9SomethingC1Ev()

define void @_Z3foov() {
  %1 = call ptr @_Znam(), !dbg !3
  call void @_ZN9SomethingC1Ev(), !dbg !3
  ret void
}

declare ptr @_Znam()

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!2}

!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1)
!1 = !DIFile(filename: "something.cc", directory: "/")
!2 = !{i32 2, !"Debug Info Version", i32 3}
!3 = !DILocation(line: 106, column: 12, scope: !4)
!4 = distinct !DISubprogram(name: "Init", linkageName: "_Z3foov", scope: !5, file: !1, line: 100, type: !7, scopeLine: 100, spFlags: DISPFlagDefinition, unit: !0)
!5 = distinct !DICompositeType(tag: DW_TAG_class_type, name: "Something", file: !1)
!6 = !{}
!7 = distinct !DISubroutineType(types: !6)