File: global-ctor.ll

package info (click to toggle)
llvm-toolchain-19 1%3A19.1.7-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,998,520 kB
  • sloc: cpp: 6,951,680; ansic: 1,486,157; asm: 913,598; python: 232,024; f90: 80,126; objc: 75,281; lisp: 37,276; pascal: 16,990; sh: 10,009; ml: 5,058; perl: 4,724; awk: 3,523; makefile: 3,167; javascript: 2,504; xml: 892; fortran: 664; cs: 573
file content (43 lines) | stat: -rw-r--r-- 1,845 bytes parent folder | download | duplicates (12)
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
;; For a global constructor, _GLOBAL__sub_I_ only has artificial lines.
;; Test that we don't instrument those functions.
; RUN: mkdir -p %t && cd %t
; RUN: opt -S -passes=insert-gcov-profiling < %s | FileCheck %s

@var = dso_local global i32 0, align 4
@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_a.cc, ptr null }]

define internal void @__cxx_global_var_init() section ".text.startup" !dbg !7 {
; CHECK: define internal void @__cxx_global_var_init()
; CHECK: @__llvm_gcov_ctr
; CHECK: call i32 @_Z3foov()
entry:
  %call = call i32 @_Z3foov(), !dbg !9
  store i32 %call, ptr @var, align 4, !dbg !9
  ret void, !dbg !9
}

declare i32 @_Z3foov()

;; Artificial lines only. Don't instrument.
define internal void @_GLOBAL__sub_I_a.cc() section ".text.startup" !dbg !10 {
; CHECK: define internal void @_GLOBAL__sub_I_a.cc()
; CHECK-NOT: @__llvm_gcov_ctr
; CHECK: call void @__cxx_global_var_init()
entry:
  call void @__cxx_global_var_init(), !dbg !11
  ret void
}

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}

!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, emissionKind: LineTablesOnly)
!1 = !DIFile(filename: "a.cc", directory: "/")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!7 = distinct !DISubprogram(name: "__cxx_global_var_init", scope: !1, file: !1, line: 2, type: !8, scopeLine: 2, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !2)
!8 = !DISubroutineType(types: !2)
!9 = !DILocation(line: 2, column: 11, scope: !7)
!10 = distinct !DISubprogram(linkageName: "_GLOBAL__sub_I_a.cc", scope: !1, file: !1, type: !8, flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !2)
!11 = !DILocation(line: 0, scope: !10)