44 lines · plain
1;; For a global constructor, _GLOBAL__sub_I_ only has artificial lines.2;; Test that we don't instrument those functions.3; RUN: mkdir -p %t && cd %t4; RUN: opt -S -passes=insert-gcov-profiling < %s | FileCheck %s5 6@var = dso_local global i32 0, align 47@llvm.global_ctors = appending global [1 x { i32, ptr, ptr }] [{ i32, ptr, ptr } { i32 65535, ptr @_GLOBAL__sub_I_a.cc, ptr null }]8 9define internal void @__cxx_global_var_init() section ".text.startup" !dbg !7 {10; CHECK: define internal void @__cxx_global_var_init()11; CHECK: @__llvm_gcov_ctr12; CHECK: call i32 @_Z3foov()13entry:14 %call = call i32 @_Z3foov(), !dbg !915 store i32 %call, ptr @var, align 4, !dbg !916 ret void, !dbg !917}18 19declare i32 @_Z3foov()20 21;; Artificial lines only. Don't instrument.22define internal void @_GLOBAL__sub_I_a.cc() section ".text.startup" !dbg !10 {23; CHECK: define internal void @_GLOBAL__sub_I_a.cc()24; CHECK-NOT: @__llvm_gcov_ctr25; CHECK: call void @__cxx_global_var_init()26entry:27 call void @__cxx_global_var_init(), !dbg !1128 ret void29}30 31!llvm.dbg.cu = !{!0}32!llvm.module.flags = !{!3, !4}33 34!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, emissionKind: LineTablesOnly)35!1 = !DIFile(filename: "a.cc", directory: "/")36!2 = !{}37!3 = !{i32 7, !"Dwarf Version", i32 4}38!4 = !{i32 2, !"Debug Info Version", i32 3}39!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)40!8 = !DISubroutineType(types: !2)41!9 = !DILocation(line: 2, column: 11, scope: !7)42!10 = distinct !DISubprogram(linkageName: "_GLOBAL__sub_I_a.cc", scope: !1, file: !1, type: !8, flags: DIFlagArtificial, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !2)43!11 = !DILocation(line: 0, scope: !10)44