xref: /llvm-project/llvm/test/Transforms/SampleProfile/pseudo-probe-discriminator.ll (revision e20b90472160e47112886d959bbe0bbeff50b8ee)
1; RUN: opt < %s -passes='default<O2>' -debug-info-for-profiling -S | FileCheck %s --check-prefix=DEBUG
2; RUN: opt < %s -passes='default<O2>' -debug-info-for-profiling -pseudo-probe-for-profiling -S | FileCheck %s --check-prefix=PROBE
3; RUN: opt < %s -passes='thinlto-pre-link<O2>' -debug-info-for-profiling -pseudo-probe-for-profiling -S | FileCheck %s --check-prefix=PROBE
4
5
6@a = dso_local global i32 0, align 4
7
8; Function Attrs: uwtable
9define void @_Z3foov(i32 %x) #0 !dbg !4 {
10bb0:
11  %cmp = icmp eq i32 %x, 0, !dbg !10
12  br i1 %cmp, label %bb1, label %bb2
13
14bb1:
15; DEBUG:  call void @_Z3barv(), !dbg ![[CALL1:[0-9]+]]
16; PROBE:  call void @_Z3barv(), !dbg ![[CALL1:[0-9]+]]
17  call void @_Z3barv(), !dbg !10
18; DEBUG:  call void @_Z3barv(), !dbg ![[CALL2:[0-9]+]]
19; PROBE:  call void @_Z3barv(), !dbg ![[CALL2:[0-9]+]]
20  call void @_Z3barv(), !dbg !11
21  ret void, !dbg !13
22
23bb2:
24; DEBUG:  store i32 8, ptr @a, align 4, !dbg ![[INST:[0-9]+]]
25; PROBE:  store i32 8, ptr @a, align 4, !dbg ![[INST:[0-9]+]]
26  store i32 8, ptr @a, align 4, !dbg !12
27  br label %bb3
28
29bb3:
30  ret void, !dbg !12
31}
32
33declare void @_Z3barv() #1
34declare void @llvm.lifetime.start.p0(i64, ptr nocapture) nounwind argmemonly
35declare void @llvm.lifetime.end.p0(i64, ptr nocapture) nounwind argmemonly
36
37attributes #0 = { uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
38attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
39
40!llvm.dbg.cu = !{!0}
41!llvm.module.flags = !{!7, !8}
42!llvm.ident = !{!9}
43
44!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.8.0 (trunk 250915) (llvm/trunk 251830)", isOptimized: false, runtimeVersion: 0, emissionKind: NoDebug, enums: !2)
45!1 = !DIFile(filename: "c.cc", directory: "/tmp")
46!2 = !{}
47!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
48!5 = !DISubroutineType(types: !6)
49!6 = !{null}
50!7 = !{i32 2, !"Dwarf Version", i32 4}
51!8 = !{i32 2, !"Debug Info Version", i32 3}
52!9 = !{!"clang version 3.8.0 (trunk 250915) (llvm/trunk 251830)"}
53!10 = !DILocation(line: 4, column: 3, scope: !4)
54!11 = !DILocation(line: 4, column: 9, scope: !4)
55!12 = !DILocation(line: 4, column: 15, scope: !4)
56!13 = !DILocation(line: 5, column: 1, scope: !4)
57
58; DEBUG: ![[CALL1]] = !DILocation(line: 4, column: 3, scope: ![[CALL1BLOCK:[0-9]+]])
59; DEBUG: ![[CALL1BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 2)
60; DEBUG: ![[CALL2]] = !DILocation(line: 4, column: 9, scope: ![[CALL2BLOCK:[0-9]+]])
61; DEBUG: ![[CALL2BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 8)
62; DEBUG: ![[INST]] = !DILocation(line: 4, column: 15, scope: ![[INSTBLOCK:[0-9]+]])
63; DEBUG: ![[INSTBLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 4)
64
65
66; PROBE: ![[CALL1]] = !DILocation(line: 4, column: 3, scope: ![[CALL1BLOCK:[0-9]+]])
67; PROBE: ![[CALL1BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 455147551)
68; PROBE: ![[CALL2]] = !DILocation(line: 4, column: 9, scope: ![[CALL2BLOCK:[0-9]+]])
69; PROBE: ![[CALL2BLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 455344167)
70; PROBE: ![[INST]] = !DILocation(line: 4, column: 15, scope: ![[INSTBLOCK:[0-9]+]])
71; PROBE: ![[INSTBLOCK]] = !DILexicalBlockFile({{.*}} discriminator: 4)
72