xref: /llvm-project/llvm/test/Transforms/GCOVProfiling/noprofile.ll (revision 12e78ff88105f2dc6cb1449d6fcd5d8f69e0512f)
1; NOTE: Assertions have been autogenerated by utils/update_test_checks.py
2; RUN: mkdir -p %t && cd %t
3; RUN: opt < %s -passes=insert-gcov-profiling -S | FileCheck %s
4
5; Test that the noprofile attribute disables profiling.
6define dso_local i32 @no_instr(i32 %a) noprofile !dbg !9 {
7; CHECK-LABEL: @no_instr(
8; CHECK-NEXT:    ret i32 42, !dbg [[DBG6:![0-9]+]]
9;
10  ret i32 42, !dbg !27
11}
12
13; Test that the skipprofile attribute disables profiling.
14define dso_local i32 @skip_instr(i32 %a) skipprofile {
15; CHECK-LABEL: @skip_instr(
16; CHECK-NEXT:    ret i32 52
17;
18  ret i32 52
19}
20
21define dso_local i32 @instr(i32 %a) !dbg !28 {
22; CHECK-LABEL: @instr(
23; CHECK-NEXT:    [[GCOV_CTR:%.*]] = load i64, ptr @__llvm_gcov_ctr, align 4, !dbg [[DBG8:![0-9]+]]
24; CHECK-NEXT:    [[TMP1:%.*]] = add i64 [[GCOV_CTR]], 1, !dbg [[DBG8]]
25; CHECK-NEXT:    store i64 [[TMP1]], ptr @__llvm_gcov_ctr, align 4, !dbg [[DBG8]]
26; CHECK-NEXT:    ret i32 42, !dbg [[DBG8]]
27;
28  ret i32 42, !dbg !44
29}
30
31!llvm.dbg.cu = !{!0}
32!llvm.module.flags = !{!3}
33
34!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug, enums: !2)
35!1 = !DIFile(filename: "a.c", directory: "")
36!2 = !{}
37!3 = !{i32 2, !"Debug Info Version", i32 3}
38!9 = distinct !DISubprogram(name: "no_instr", scope: !1, file: !1, line: 5, type: !10, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
39!10 = !DISubroutineType(types: !2)
40!27 = !DILocation(line: 9, column: 3, scope: !9)
41!28 = distinct !DISubprogram(name: "instr", scope: !1, file: !1, line: 12, type: !10, scopeLine: 12, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
42!44 = !DILocation(line: 16, column: 3, scope: !28)
43