xref: /llvm-project/llvm/test/Transforms/GCOVProfiling/atomic-counter.ll (revision 41d5033eb162cb92b684855166cabfa3983b74c6)
1;; -fsanitize=thread requires the (potentially concurrent) counter updates to be atomic.
2; RUN: mkdir -p %t && cd %t
3; RUN: opt < %s -S -passes=insert-gcov-profiling -gcov-atomic-counter | FileCheck %s
4
5; CHECK-LABEL: void @empty()
6; CHECK-NEXT:  entry:
7; CHECK-NEXT:    %0 = atomicrmw add ptr @__llvm_gcov_ctr, i64 1 monotonic, align 8, !dbg [[DBG:![0-9]+]]
8; CHECK-NEXT:    ret void, !dbg [[DBG]]
9
10define dso_local void @empty() !dbg !5 {
11entry:
12  ret void, !dbg !8
13}
14
15!llvm.dbg.cu = !{!0}
16!llvm.module.flags = !{!3, !4}
17
18!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug, enums: !2)
19!1 = !DIFile(filename: "a.c", directory: "")
20!2 = !{}
21!3 = !{i32 7, !"Dwarf Version", i32 5}
22!4 = !{i32 2, !"Debug Info Version", i32 3}
23!5 = distinct !DISubprogram(name: "empty", scope: !1, file: !1, line: 1, type: !6, scopeLine: 1, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
24!6 = !DISubroutineType(types: !7)
25!7 = !{null}
26!8 = !DILocation(line: 2, column: 1, scope: !5)
27