1 ; RUN: llc -debug-entry-values %s -o - -filetype=obj \
2 ; RUN: | llvm-dwarfdump -statistics - | FileCheck %s
4 ; CHECK: "entry value scope bytes covered":5
5 ; CHECK: "formal params scope bytes total":20
6 ; CHECK: "formal params scope bytes covered":20
7 ; CHECK: "formal params entry value scope bytes covered":5
8 ; CHECK: "vars scope bytes total":78
9 ; CHECK: "vars scope bytes covered":60
10 ; CHECK: "vars entry value scope bytes covered":0
11 ; CHECK: "total variables procesed by location statistics":6
12 ; CHECK: "variables with 0% of its scope covered":1
13 ; CHECK: "variables with 1-9% of its scope covered":0
14 ; CHECK: "variables with 10-19% of its scope covered":0
15 ; CHECK: "variables with 20-29% of its scope covered":0
16 ; CHECK: "variables with 30-39% of its scope covered":0
17 ; CHECK: "variables with 40-49% of its scope covered":0
18 ; CHECK: "variables with 50-59% of its scope covered":1
19 ; CHECK: "variables with 60-69% of its scope covered":0
20 ; CHECK: "variables with 70-79% of its scope covered":0
21 ; CHECK: "variables with 80-89% of its scope covered":1
22 ; CHECK: "variables with 90-99% of its scope covered":0
23 ; CHECK: "variables with 100% of its scope covered":3
24 ; CHECK: "variables (excluding the debug entry values) with 0% of its scope covered":1
25 ; CHECK: "variables (excluding the debug entry values) with 1-9% of its scope covered":0
26 ; CHECK: "variables (excluding the debug entry values) with 10-19% of its scope covered":0
27 ; CHECK: "variables (excluding the debug entry values) with 20-29% of its scope covered":0
28 ; CHECK: "variables (excluding the debug entry values) with 30-39% of its scope covered":0
29 ; CHECK: "variables (excluding the debug entry values) with 40-49% of its scope covered":0
30 ; CHECK: "variables (excluding the debug entry values) with 50-59% of its scope covered":2
31 ; CHECK: "variables (excluding the debug entry values) with 60-69% of its scope covered":0
32 ; CHECK: "variables (excluding the debug entry values) with 70-79% of its scope covered":0
33 ; CHECK: "variables (excluding the debug entry values) with 80-89% of its scope covered":1
34 ; CHECK: "variables (excluding the debug entry values) with 90-99% of its scope covered":0
35 ; CHECK: "variables (excluding the debug entry values) with 100% of its scope covered":2
36 ; CHECK: "total params procesed by location statistics":2
37 ; CHECK: "params with 0% of its scope covered":0
38 ; CHECK: "params with 1-9% of its scope covered":0
39 ; CHECK: "params with 10-19% of its scope covered":0
40 ; CHECK: "params with 20-29% of its scope covered":0
41 ; CHECK: "params with 30-39% of its scope covered":0
42 ; CHECK: "params with 40-49% of its scope covered":0
43 ; CHECK: "params with 50-59% of its scope covered":0
44 ; CHECK: "params with 60-69% of its scope covered":0
45 ; CHECK: "params with 70-79% of its scope covered":0
46 ; CHECK: "params with 80-89% of its scope covered":0
47 ; CHECK: "params with 90-99% of its scope covered":0
48 ; CHECK: "params with 100% of its scope covered":2
49 ; CHECK: "params (excluding the debug entry values) with 0% of its scope covered":0
50 ; CHECK: "params (excluding the debug entry values) with 1-9% of its scope covered":0
51 ; CHECK: "params (excluding the debug entry values) with 10-19% of its scope covered":0
52 ; CHECK: "params (excluding the debug entry values) with 20-29% of its scope covered":0
53 ; CHECK: "params (excluding the debug entry values) with 30-39% of its scope covered":0
54 ; CHECK: "params (excluding the debug entry values) with 40-49% of its scope covered":0
55 ; CHECK: "params (excluding the debug entry values) with 50-59% of its scope covered":1
56 ; CHECK: "params (excluding the debug entry values) with 60-69% of its scope covered":0
57 ; CHECK: "params (excluding the debug entry values) with 70-79% of its scope covered":0
58 ; CHECK: "params (excluding the debug entry values) with 80-89% of its scope covered":0
59 ; CHECK: "params (excluding the debug entry values) with 90-99% of its scope covered":0
60 ; CHECK: "params (excluding the debug entry values) with 100% of its scope covered":1
61 ; CHECK: "total vars procesed by location statistics":4
62 ; CHECK: "vars with 0% of its scope covered":1
63 ; CHECK: "vars with 1-9% of its scope covered":0
64 ; CHECK: "vars with 10-19% of its scope covered":0
65 ; CHECK: "vars with 20-29% of its scope covered":0
66 ; CHECK: "vars with 30-39% of its scope covered":0
67 ; CHECK: "vars with 40-49% of its scope covered":0
68 ; CHECK: "vars with 50-59% of its scope covered":1
69 ; CHECK: "vars with 60-69% of its scope covered":0
70 ; CHECK: "vars with 70-79% of its scope covered":0
71 ; CHECK: "vars with 80-89% of its scope covered":1
72 ; CHECK: "vars with 90-99% of its scope covered":0
73 ; CHECK: "vars with 100% of its scope covered":1
74 ; CHECK: "vars (excluding the debug entry values) with 0% of its scope covered":1
75 ; CHECK: "vars (excluding the debug entry values) with 1-9% of its scope covered":0
76 ; CHECK: "vars (excluding the debug entry values) with 10-19% of its scope covered":0
77 ; CHECK: "vars (excluding the debug entry values) with 20-29% of its scope covered":0
78 ; CHECK: "vars (excluding the debug entry values) with 30-39% of its scope covered":0
79 ; CHECK: "vars (excluding the debug entry values) with 40-49% of its scope covered":0
80 ; CHECK: "vars (excluding the debug entry values) with 50-59% of its scope covered":1
81 ; CHECK: "vars (excluding the debug entry values) with 60-69% of its scope covered":0
82 ; CHECK: "vars (excluding the debug entry values) with 70-79% of its scope covered":0
83 ; CHECK: "vars (excluding the debug entry values) with 80-89% of its scope covered":1
84 ; CHECK: "vars (excluding the debug entry values) with 90-99% of its scope covered":0
85 ; CHECK: "vars (excluding the debug entry values) with 100% of its scope covered":1
87 ; The source code of the test case:
88 ; extern void fn3(int *);
89 ; extern void fn2 (int);
90 ; __attribute__((noinline))
106 ; __attribute__((noinline))
116 ; ModuleID = 'test.c'
117 source_filename = "test.c"
118 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
119 target triple = "x86_64-unknown-linux-gnu"
121 ; Function Attrs: noinline nounwind uwtable
122 define dso_local void @fn1(i32 %x, i32 %y) local_unnamed_addr !dbg !16 {
124 call void @llvm.dbg.value(metadata i32 %x, metadata !20, metadata !DIExpression()), !dbg !24
125 call void @llvm.dbg.value(metadata i32 %y, metadata !21, metadata !DIExpression()), !dbg !24
126 call void @llvm.dbg.value(metadata i32 undef, metadata !22, metadata !DIExpression()), !dbg !24
127 call void @llvm.dbg.value(metadata i32 undef, metadata !22, metadata !DIExpression()), !dbg !24
128 call void @llvm.dbg.value(metadata i32 7, metadata !23, metadata !DIExpression()), !dbg !24
129 tail call void @fn2(i32 7), !dbg !25
130 call void @llvm.dbg.value(metadata i32 undef, metadata !22, metadata !DIExpression(DW_OP_constu, 1, DW_OP_minus, DW_OP_stack_value)), !dbg !24
134 ; Function Attrs: argmemonly nounwind willreturn
135 declare void @llvm.lifetime.start.p0i8(i64 immarg, i8* nocapture)
137 declare !dbg !4 dso_local void @fn2(i32) local_unnamed_addr
139 ; Function Attrs: argmemonly nounwind willreturn
140 declare void @llvm.lifetime.end.p0i8(i64 immarg, i8* nocapture)
142 ; Function Attrs: noinline nounwind uwtable
143 define dso_local i32 @f() local_unnamed_addr !dbg !27 {
145 %l = alloca i32, align 4
146 %k = alloca i32, align 4
147 %0 = bitcast i32* %l to i8*, !dbg !33
148 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %0), !dbg !33
149 %1 = bitcast i32* %k to i8*, !dbg !33
150 call void @llvm.lifetime.start.p0i8(i64 4, i8* nonnull %1), !dbg !33
151 call void @llvm.dbg.value(metadata i32* %l, metadata !31, metadata !DIExpression(DW_OP_deref)), !dbg !34
152 call void @fn3(i32* nonnull %l), !dbg !35
153 call void @llvm.dbg.value(metadata i32* %k, metadata !32, metadata !DIExpression(DW_OP_deref)), !dbg !34
154 call void @fn3(i32* nonnull %k), !dbg !36
155 %2 = load i32, i32* %l, align 4, !dbg !37
156 call void @llvm.dbg.value(metadata i32 %2, metadata !31, metadata !DIExpression()), !dbg !34
157 %3 = load i32, i32* %k, align 4, !dbg !37
158 call void @llvm.dbg.value(metadata i32 %3, metadata !32, metadata !DIExpression()), !dbg !34
159 call void @fn1(i32 %2, i32 %3), !dbg !37
160 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %1), !dbg !37
161 call void @llvm.lifetime.end.p0i8(i64 4, i8* nonnull %0), !dbg !37
165 declare !dbg !8 dso_local void @fn3(i32*) local_unnamed_addr
167 ; Function Attrs: nounwind readnone speculatable willreturn
168 declare void @llvm.dbg.value(metadata, metadata, metadata)
171 !llvm.module.flags = !{!12, !13, !14}
174 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None)
175 !1 = !DIFile(filename: "test.c", directory: "/")
178 !4 = !DISubprogram(name: "fn2", scope: !1, file: !1, line: 2, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
179 !5 = !DISubroutineType(types: !6)
181 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
182 !8 = !DISubprogram(name: "fn3", scope: !1, file: !1, line: 1, type: !9, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
183 !9 = !DISubroutineType(types: !10)
185 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64)
186 !12 = !{i32 2, !"Dwarf Version", i32 4}
187 !13 = !{i32 2, !"Debug Info Version", i32 3}
188 !14 = !{i32 1, !"wchar_size", i32 4}
189 !15 = !{!"clang version 10.0.0"}
190 !16 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 6, type: !17, scopeLine: 7, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !19)
191 !17 = !DISubroutineType(types: !18)
192 !18 = !{null, !7, !7}
193 !19 = !{!20, !21, !22, !23}
194 !20 = !DILocalVariable(name: "x", arg: 1, scope: !16, file: !1, line: 6, type: !7, flags: DIFlagArgumentNotModified)
195 !21 = !DILocalVariable(name: "y", arg: 2, scope: !16, file: !1, line: 6, type: !7, flags: DIFlagArgumentNotModified)
196 !22 = !DILocalVariable(name: "u", scope: !16, file: !1, line: 8, type: !7)
197 !23 = !DILocalVariable(name: "a", scope: !16, file: !1, line: 18, type: !7)
198 !24 = !DILocation(line: 0, scope: !16)
199 !25 = !DILocation(line: 20, column: 3, scope: !16)
200 !26 = !DILocation(line: 22, column: 1, scope: !16)
201 !27 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 25, type: !28, scopeLine: 26, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !30)
202 !28 = !DISubroutineType(types: !29)
205 !31 = !DILocalVariable(name: "l", scope: !27, file: !1, line: 27, type: !7)
206 !32 = !DILocalVariable(name: "k", scope: !27, file: !1, line: 27, type: !7)
207 !33 = !DILocation(line: 27, column: 3, scope: !27)
208 !34 = !DILocation(line: 0, scope: !27)
209 !35 = !DILocation(line: 29, column: 3, scope: !27)
210 !36 = !DILocation(line: 30, column: 3, scope: !27)
211 !37 = !DILocation(line: 32, column: 8, scope: !27)