| 1 |
; RUN: llc -debug-entry-values %s -o - -filetype=obj \ |
| 2 |
; RUN: | llvm-dwarfdump -statistics - | FileCheck %s |
| 3 |
; RUN: llc -debug-entry-values --dwarf-version=4 %s -o - -filetype=obj \ |
| 4 |
; RUN: | llvm-dwarfdump -statistics - | FileCheck %s |
| 5 |
; RUN: llc -debug-entry-values --dwarf-version=3 %s -o - -filetype=obj \ |
| 6 |
; RUN: | llvm-dwarfdump -statistics - | FileCheck %s |
| 7 |
; RUN: llc -debug-entry-values --dwarf-version=2 %s -o - -filetype=obj \ |
| 8 |
; RUN: | llvm-dwarfdump -statistics - | FileCheck %s |
| 9 |
|
| 10 |
; CHECK: "sum_all_variables(#bytes in parent scope covered by DW_OP_entry_value)": 5, |
| 11 |
; CHECK-NEXT: "sum_all_params(#bytes in parent scope)": 20, |
| 12 |
; CHECK-NEXT: "sum_all_params(#bytes in parent scope covered by DW_AT_location)": 20, |
| 13 |
; CHECK-NEXT: "sum_all_params(#bytes in parent scope covered by DW_OP_entry_value)": 5, |
| 14 |
; CHECK-NEXT: "sum_all_local_vars(#bytes in parent scope)": 90, |
| 15 |
; CHECK-NEXT: "sum_all_local_vars(#bytes in parent scope covered by DW_AT_location)": 60, |
| 16 |
; CHECK-NEXT: "sum_all_local_vars(#bytes in parent scope covered by DW_OP_entry_value)": 0, |
| 17 |
; CHECK-NEXT: "#bytes within functions": 45, |
| 18 |
; CHECK-NEXT: "#bytes within inlined functions": 0, |
| 19 |
; CHECK-NEXT: "#params": 2, |
| 20 |
; CHECK-NEXT: "#params with source location": 2, |
| 21 |
; CHECK-NEXT: "#params with type": 2, |
| 22 |
; CHECK-NEXT: "#params with binary location": 2, |
| 23 |
; CHECK: "#variables processed by location statistics": 6, |
| 24 |
; CHECK-NEXT: "#variables with 0% of parent scope covered by DW_AT_location": 1, |
| 25 |
; CHECK-NEXT: "#variables with (0%,10%) of parent scope covered by DW_AT_location": 0, |
| 26 |
; CHECK-NEXT: "#variables with [10%,20%) of parent scope covered by DW_AT_location": 0, |
| 27 |
; CHECK-NEXT: "#variables with [20%,30%) of parent scope covered by DW_AT_location": 0, |
| 28 |
; CHECK-NEXT: "#variables with [30%,40%) of parent scope covered by DW_AT_location": 0, |
| 29 |
; CHECK-NEXT: "#variables with [40%,50%) of parent scope covered by DW_AT_location": 0, |
| 30 |
; CHECK-NEXT: "#variables with [50%,60%) of parent scope covered by DW_AT_location": 1, |
| 31 |
; CHECK-NEXT: "#variables with [60%,70%) of parent scope covered by DW_AT_location": 0, |
| 32 |
; CHECK-NEXT: "#variables with [70%,80%) of parent scope covered by DW_AT_location": 0, |
| 33 |
; CHECK-NEXT: "#variables with [80%,90%) of parent scope covered by DW_AT_location": 1, |
| 34 |
; CHECK-NEXT: "#variables with [90%,100%) of parent scope covered by DW_AT_location": 0, |
| 35 |
; CHECK-NEXT: "#variables with 100% of parent scope covered by DW_AT_location": 3, |
| 36 |
; CHECK-NEXT: "#variables - entry values with 0% of parent scope covered by DW_AT_location": 1, |
| 37 |
; CHECK-NEXT: "#variables - entry values with (0%,10%) of parent scope covered by DW_AT_location": 0, |
| 38 |
; CHECK-NEXT: "#variables - entry values with [10%,20%) of parent scope covered by DW_AT_location": 0, |
| 39 |
; CHECK-NEXT: "#variables - entry values with [20%,30%) of parent scope covered by DW_AT_location": 0, |
| 40 |
; CHECK-NEXT: "#variables - entry values with [30%,40%) of parent scope covered by DW_AT_location": 0, |
| 41 |
; CHECK-NEXT: "#variables - entry values with [40%,50%) of parent scope covered by DW_AT_location": 0, |
| 42 |
; CHECK-NEXT: "#variables - entry values with [50%,60%) of parent scope covered by DW_AT_location": 2, |
| 43 |
; CHECK-NEXT: "#variables - entry values with [60%,70%) of parent scope covered by DW_AT_location": 0, |
| 44 |
; CHECK-NEXT: "#variables - entry values with [70%,80%) of parent scope covered by DW_AT_location": 0, |
| 45 |
; CHECK-NEXT: "#variables - entry values with [80%,90%) of parent scope covered by DW_AT_location": 1, |
| 46 |
; CHECK-NEXT: "#variables - entry values with [90%,100%) of parent scope covered by DW_AT_location": 0, |
| 47 |
; CHECK-NEXT: "#variables - entry values with 100% of parent scope covered by DW_AT_location": 2, |
| 48 |
; CHECK-NEXT: "#params processed by location statistics": 2, |
| 49 |
; CHECK-NEXT: "#params with 0% of parent scope covered by DW_AT_location": 0, |
| 50 |
; CHECK-NEXT: "#params with (0%,10%) of parent scope covered by DW_AT_location": 0, |
| 51 |
; CHECK-NEXT: "#params with [10%,20%) of parent scope covered by DW_AT_location": 0, |
| 52 |
; CHECK-NEXT: "#params with [20%,30%) of parent scope covered by DW_AT_location": 0, |
| 53 |
; CHECK-NEXT: "#params with [30%,40%) of parent scope covered by DW_AT_location": 0, |
| 54 |
; CHECK-NEXT: "#params with [40%,50%) of parent scope covered by DW_AT_location": 0, |
| 55 |
; CHECK-NEXT: "#params with [50%,60%) of parent scope covered by DW_AT_location": 0, |
| 56 |
; CHECK-NEXT: "#params with [60%,70%) of parent scope covered by DW_AT_location": 0, |
| 57 |
; CHECK-NEXT: "#params with [70%,80%) of parent scope covered by DW_AT_location": 0, |
| 58 |
; CHECK-NEXT: "#params with [80%,90%) of parent scope covered by DW_AT_location": 0, |
| 59 |
; CHECK-NEXT: "#params with [90%,100%) of parent scope covered by DW_AT_location": 0, |
| 60 |
; CHECK-NEXT: "#params with 100% of parent scope covered by DW_AT_location": 2, |
| 61 |
; CHECK-NEXT: "#params - entry values with 0% of parent scope covered by DW_AT_location": 0, |
| 62 |
; CHECK-NEXT: "#params - entry values with (0%,10%) of parent scope covered by DW_AT_location": 0, |
| 63 |
; CHECK-NEXT: "#params - entry values with [10%,20%) of parent scope covered by DW_AT_location": 0, |
| 64 |
; CHECK-NEXT: "#params - entry values with [20%,30%) of parent scope covered by DW_AT_location": 0, |
| 65 |
; CHECK-NEXT: "#params - entry values with [30%,40%) of parent scope covered by DW_AT_location": 0, |
| 66 |
; CHECK-NEXT: "#params - entry values with [40%,50%) of parent scope covered by DW_AT_location": 0, |
| 67 |
; CHECK-NEXT: "#params - entry values with [50%,60%) of parent scope covered by DW_AT_location": 1, |
| 68 |
; CHECK-NEXT: "#params - entry values with [60%,70%) of parent scope covered by DW_AT_location": 0, |
| 69 |
; CHECK-NEXT: "#params - entry values with [70%,80%) of parent scope covered by DW_AT_location": 0, |
| 70 |
; CHECK-NEXT: "#params - entry values with [80%,90%) of parent scope covered by DW_AT_location": 0, |
| 71 |
; CHECK-NEXT: "#params - entry values with [90%,100%) of parent scope covered by DW_AT_location": 0, |
| 72 |
; CHECK-NEXT: "#params - entry values with 100% of parent scope covered by DW_AT_location": 1, |
| 73 |
; CHECK-NEXT: "#local vars processed by location statistics": 4, |
| 74 |
; CHECK-NEXT: "#local vars with 0% of parent scope covered by DW_AT_location": 1, |
| 75 |
; CHECK-NEXT: "#local vars with (0%,10%) of parent scope covered by DW_AT_location": 0, |
| 76 |
; CHECK-NEXT: "#local vars with [10%,20%) of parent scope covered by DW_AT_location": 0, |
| 77 |
; CHECK-NEXT: "#local vars with [20%,30%) of parent scope covered by DW_AT_location": 0, |
| 78 |
; CHECK-NEXT: "#local vars with [30%,40%) of parent scope covered by DW_AT_location": 0, |
| 79 |
; CHECK-NEXT: "#local vars with [40%,50%) of parent scope covered by DW_AT_location": 0, |
| 80 |
; CHECK-NEXT: "#local vars with [50%,60%) of parent scope covered by DW_AT_location": 1, |
| 81 |
; CHECK-NEXT: "#local vars with [60%,70%) of parent scope covered by DW_AT_location": 0, |
| 82 |
; CHECK-NEXT: "#local vars with [70%,80%) of parent scope covered by DW_AT_location": 0, |
| 83 |
; CHECK-NEXT: "#local vars with [80%,90%) of parent scope covered by DW_AT_location": 1, |
| 84 |
; CHECK-NEXT: "#local vars with [90%,100%) of parent scope covered by DW_AT_location": 0, |
| 85 |
; CHECK-NEXT: "#local vars with 100% of parent scope covered by DW_AT_location": 1, |
| 86 |
; CHECK-NEXT: "#local vars - entry values with 0% of parent scope covered by DW_AT_location": 1, |
| 87 |
; CHECK-NEXT: "#local vars - entry values with (0%,10%) of parent scope covered by DW_AT_location": 0, |
| 88 |
; CHECK-NEXT: "#local vars - entry values with [10%,20%) of parent scope covered by DW_AT_location": 0, |
| 89 |
; CHECK-NEXT: "#local vars - entry values with [20%,30%) of parent scope covered by DW_AT_location": 0, |
| 90 |
; CHECK-NEXT: "#local vars - entry values with [30%,40%) of parent scope covered by DW_AT_location": 0, |
| 91 |
; CHECK-NEXT: "#local vars - entry values with [40%,50%) of parent scope covered by DW_AT_location": 0, |
| 92 |
; CHECK-NEXT: "#local vars - entry values with [50%,60%) of parent scope covered by DW_AT_location": 1, |
| 93 |
; CHECK-NEXT: "#local vars - entry values with [60%,70%) of parent scope covered by DW_AT_location": 0, |
| 94 |
; CHECK-NEXT: "#local vars - entry values with [70%,80%) of parent scope covered by DW_AT_location": 0, |
| 95 |
; CHECK-NEXT: "#local vars - entry values with [80%,90%) of parent scope covered by DW_AT_location": 1, |
| 96 |
; CHECK-NEXT: "#local vars - entry values with [90%,100%) of parent scope covered by DW_AT_location": 0, |
| 97 |
; CHECK-NEXT: "#local vars - entry values with 100% of parent scope covered by DW_AT_location": 1 |
| 98 |
; CHECK-NEXT: "#bytes with line information": 51, |
| 99 |
; CHECK-NEXT: "#bytes with line-0 locations": 3, |
| 100 |
; CHECK-NEXT: "#line entries": 7, |
| 101 |
; CHECK-NEXT: "#line entries (is_stmt)": 5, |
| 102 |
; CHECK-NEXT: "#line entries (unique)": 6, |
| 103 |
; CHECK-NEXT: "#line entries (unique non-0)": 5 |
| 104 |
|
| 105 |
; The source code of the test case: |
| 106 |
; extern void fn3(int *); |
| 107 |
; extern void fn2 (int); |
| 108 |
; __attribute__((noinline)) |
| 109 |
; void |
| 110 |
; fn1 (int x, int y) |
| 111 |
; { |
| 112 |
; int u = x + y; |
| 113 |
; if (x > 1) |
| 114 |
; u += 1; |
| 115 |
; else |
| 116 |
; u += 2; |
| 117 |
; if (y > 4) |
| 118 |
; u += x; |
| 119 |
; int a = 7; |
| 120 |
; fn2 (a); |
| 121 |
; u --; |
| 122 |
; } |
| 123 |
|
| 124 |
; __attribute__((noinline)) |
| 125 |
; int f() |
| 126 |
; { |
| 127 |
; int l, k; |
| 128 |
; fn3(&l); |
| 129 |
; fn3(&k); |
| 130 |
; fn1 (l, k); |
| 131 |
; return 0; |
| 132 |
; } |
| 133 |
|
| 134 |
; ModuleID = 'test.c' |
| 135 |
source_filename = "test.c" |
| 136 |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" |
| 137 |
target triple = "x86_64-unknown-linux-gnu" |
| 138 |
|
| 139 |
; Function Attrs: noinline nounwind uwtable |
| 140 |
define dso_local void @fn1(i32 %x, i32 %y) local_unnamed_addr !dbg !16 { |
| 141 |
entry: |
| 142 |
call void @llvm.dbg.value(metadata i32 %x, metadata !20, metadata !DIExpression()), !dbg !24 |
| 143 |
call void @llvm.dbg.value(metadata i32 %y, metadata !21, metadata !DIExpression()), !dbg !24 |
| 144 |
call void @llvm.dbg.value(metadata i32 undef, metadata !22, metadata !DIExpression()), !dbg !24 |
| 145 |
call void @llvm.dbg.value(metadata i32 undef, metadata !22, metadata !DIExpression()), !dbg !24 |
| 146 |
call void @llvm.dbg.value(metadata i32 7, metadata !23, metadata !DIExpression()), !dbg !24 |
| 147 |
tail call void @fn2(i32 7), !dbg !25 |
| 148 |
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 |
| 149 |
ret void, !dbg !26 |
| 150 |
} |
| 151 |
|
| 152 |
; Function Attrs: argmemonly nounwind willreturn |
| 153 |
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) |
| 154 |
|
| 155 |
declare !dbg !4 dso_local void @fn2(i32) local_unnamed_addr |
| 156 |
|
| 157 |
; Function Attrs: argmemonly nounwind willreturn |
| 158 |
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) |
| 159 |
|
| 160 |
; Function Attrs: noinline nounwind uwtable |
| 161 |
define dso_local i32 @f() local_unnamed_addr !dbg !27 { |
| 162 |
entry: |
| 163 |
%l = alloca i32, align 4 |
| 164 |
%k = alloca i32, align 4 |
| 165 |
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %l), !dbg !33 |
| 166 |
call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %k), !dbg !33 |
| 167 |
call void @llvm.dbg.value(metadata ptr %l, metadata !31, metadata !DIExpression(DW_OP_deref)), !dbg !34 |
| 168 |
call void @fn3(ptr nonnull %l), !dbg !35 |
| 169 |
call void @llvm.dbg.value(metadata ptr %k, metadata !32, metadata !DIExpression(DW_OP_deref)), !dbg !34 |
| 170 |
call void @fn3(ptr nonnull %k), !dbg !36 |
| 171 |
%0 = load i32, ptr %l, align 4, !dbg !37 |
| 172 |
call void @llvm.dbg.value(metadata i32 %0, metadata !31, metadata !DIExpression()), !dbg !34 |
| 173 |
%1 = load i32, ptr %k, align 4, !dbg !37 |
| 174 |
call void @llvm.dbg.value(metadata i32 %1, metadata !32, metadata !DIExpression()), !dbg !34 |
| 175 |
call void @fn1(i32 %0, i32 %1), !dbg !37 |
| 176 |
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %k), !dbg !37 |
| 177 |
call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %l), !dbg !37 |
| 178 |
ret i32 0, !dbg !37 |
| 179 |
} |
| 180 |
|
| 181 |
declare !dbg !8 dso_local void @fn3(ptr) local_unnamed_addr |
| 182 |
|
| 183 |
; Function Attrs: nounwind readnone speculatable willreturn |
| 184 |
declare void @llvm.dbg.value(metadata, metadata, metadata) |
| 185 |
|
| 186 |
!llvm.dbg.cu = !{!0} |
| 187 |
!llvm.module.flags = !{!12, !13, !14} |
| 188 |
!llvm.ident = !{!15} |
| 189 |
|
| 190 |
!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) |
| 191 |
!1 = !DIFile(filename: "test.c", directory: "/") |
| 192 |
!2 = !{} |
| 193 |
!3 = !{!4, !8} |
| 194 |
!4 = !DISubprogram(name: "fn2", scope: !1, file: !1, line: 2, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) |
| 195 |
!5 = !DISubroutineType(types: !6) |
| 196 |
!6 = !{null, !7} |
| 197 |
!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 198 |
!8 = !DISubprogram(name: "fn3", scope: !1, file: !1, line: 1, type: !9, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) |
| 199 |
!9 = !DISubroutineType(types: !10) |
| 200 |
!10 = !{null, !11} |
| 201 |
!11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64) |
| 202 |
!12 = !{i32 2, !"Dwarf Version", i32 4} |
| 203 |
!13 = !{i32 2, !"Debug Info Version", i32 3} |
| 204 |
!14 = !{i32 1, !"wchar_size", i32 4} |
| 205 |
!15 = !{!"clang version 10.0.0"} |
| 206 |
!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) |
| 207 |
!17 = !DISubroutineType(types: !18) |
| 208 |
!18 = !{null, !7, !7} |
| 209 |
!19 = !{!20, !21, !22, !23} |
| 210 |
!20 = !DILocalVariable(name: "x", arg: 1, scope: !16, file: !1, line: 6, type: !7) |
| 211 |
!21 = !DILocalVariable(name: "y", arg: 2, scope: !16, file: !1, line: 6, type: !7) |
| 212 |
!22 = !DILocalVariable(name: "u", scope: !16, file: !1, line: 8, type: !7) |
| 213 |
!23 = !DILocalVariable(name: "a", scope: !16, file: !1, line: 18, type: !7) |
| 214 |
!24 = !DILocation(line: 0, scope: !16) |
| 215 |
!25 = !DILocation(line: 20, column: 3, scope: !16) |
| 216 |
!26 = !DILocation(line: 22, column: 1, scope: !16) |
| 217 |
!27 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 25, type: !28, scopeLine: 26, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !30) |
| 218 |
!28 = !DISubroutineType(types: !29) |
| 219 |
!29 = !{!7} |
| 220 |
!30 = !{!31, !32} |
| 221 |
!31 = !DILocalVariable(name: "l", scope: !27, file: !1, line: 27, type: !7) |
| 222 |
!32 = !DILocalVariable(name: "k", scope: !27, file: !1, line: 27, type: !7) |
| 223 |
!33 = !DILocation(line: 27, column: 3, scope: !27) |
| 224 |
!34 = !DILocation(line: 0, scope: !27) |
| 225 |
!35 = !DILocation(line: 29, column: 3, scope: !27) |
| 226 |
!36 = !DILocation(line: 30, column: 3, scope: !27) |
| 227 |
!37 = !DILocation(line: 32, column: 8, scope: !27) |