| 1 |
; RUN: llc -O0 %s -o - -filetype=obj \ |
| 2 |
; RUN: | llvm-dwarfdump -statistics - | FileCheck %s |
| 3 |
|
| 4 |
; Test that statistics distinguish functions with the same name. |
| 5 |
|
| 6 |
; CHECK: "#functions": 4, |
| 7 |
; CHECK: "#out-of-line functions": 4, |
| 8 |
; CHECK: "#unique source variables": 2, |
| 9 |
; CHECK-NEXT: "#source variables": 2, |
| 10 |
|
| 11 |
; $ cat test1.cpp |
| 12 |
; static int foo(int a) { |
| 13 |
; return a; |
| 14 |
; } |
| 15 |
; int boo() { return foo(42); } |
| 16 |
; |
| 17 |
; $ cat test2.cpp |
| 18 |
; static int foo(int a) { |
| 19 |
; return a; |
| 20 |
; } |
| 21 |
; int bar() { return foo(42); } |
| 22 |
|
| 23 |
source_filename = "llvm-link" |
| 24 |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 25 |
target triple = "x86_64-unknown-linux-gnu" |
| 26 |
|
| 27 |
; Function Attrs: noinline optnone uwtable |
| 28 |
define dso_local i32 @_Z3boov() !dbg !9 { |
| 29 |
entry: |
| 30 |
%call = call i32 @_ZL3fooi(i32 42), !dbg !13 |
| 31 |
ret i32 %call |
| 32 |
} |
| 33 |
; Function Attrs: noinline nounwind optnone uwtable |
| 34 |
define internal i32 @_ZL3fooi(i32 %a) !dbg !15 { |
| 35 |
entry: |
| 36 |
%a.addr = alloca i32, align 4 |
| 37 |
store i32 %a, ptr %a.addr, align 4 |
| 38 |
call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !18, metadata !DIExpression()), !dbg !19 |
| 39 |
%0 = load i32, ptr %a.addr, align 4, !dbg !20 |
| 40 |
ret i32 %0 |
| 41 |
} |
| 42 |
; Function Attrs: nounwind readnone speculatable willreturn |
| 43 |
declare void @llvm.dbg.declare(metadata, metadata, metadata) |
| 44 |
; Function Attrs: noinline optnone uwtable |
| 45 |
define dso_local i32 @_Z3barv() !dbg !22 { |
| 46 |
entry: |
| 47 |
%call = call i32 @_ZL3fooi.1(i32 442), !dbg !23 |
| 48 |
ret i32 %call |
| 49 |
} |
| 50 |
; Function Attrs: noinline nounwind optnone uwtable |
| 51 |
define internal i32 @_ZL3fooi.1(i32 %a) !dbg !25 { |
| 52 |
entry: |
| 53 |
%a.addr = alloca i32, align 4 |
| 54 |
store i32 %a, ptr %a.addr, align 4 |
| 55 |
call void @llvm.dbg.declare(metadata ptr %a.addr, metadata !26, metadata !DIExpression()), !dbg !27 |
| 56 |
%0 = load i32, ptr %a.addr, align 4, !dbg !28 |
| 57 |
%mul = mul nsw i32 %0, 2 |
| 58 |
ret i32 %mul |
| 59 |
} |
| 60 |
|
| 61 |
!llvm.dbg.cu = !{!0, !3} |
| 62 |
!llvm.ident = !{!5, !5} |
| 63 |
!llvm.module.flags = !{!6, !7, !8} |
| 64 |
|
| 65 |
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 10.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) |
| 66 |
!1 = !DIFile(filename: "test1.cpp", directory: "/") |
| 67 |
!2 = !{} |
| 68 |
!3 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !4, producer: "clang version 10.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None) |
| 69 |
!4 = !DIFile(filename: "test2.cpp", directory: "/") |
| 70 |
!5 = !{!"clang version 10.0.0"} |
| 71 |
!6 = !{i32 7, !"Dwarf Version", i32 4} |
| 72 |
!7 = !{i32 2, !"Debug Info Version", i32 3} |
| 73 |
!8 = !{i32 1, !"wchar_size", i32 4} |
| 74 |
!9 = distinct !DISubprogram(name: "boo", linkageName: "_Z3boov", scope: !1, file: !1, line: 5, type: !10, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) |
| 75 |
!10 = !DISubroutineType(types: !11) |
| 76 |
!11 = !{!12} |
| 77 |
!12 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) |
| 78 |
!13 = !DILocation(line: 6, column: 10, scope: !9) |
| 79 |
!15 = distinct !DISubprogram(name: "foo", linkageName: "_ZL3fooi", scope: !1, file: !1, line: 1, type: !16, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !0, retainedNodes: !2) |
| 80 |
!16 = !DISubroutineType(types: !17) |
| 81 |
!17 = !{!12, !12} |
| 82 |
!18 = !DILocalVariable(name: "a", arg: 1, scope: !15, file: !1, line: 1, type: !12) |
| 83 |
!19 = !DILocation(line: 1, column: 20, scope: !15) |
| 84 |
!20 = !DILocation(line: 2, column: 10, scope: !15) |
| 85 |
!22 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !4, file: !4, line: 5, type: !10, scopeLine: 5, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !3, retainedNodes: !2) |
| 86 |
!23 = !DILocation(line: 6, column: 10, scope: !22) |
| 87 |
!25 = distinct !DISubprogram(name: "foo", linkageName: "_ZL3fooi", scope: !4, file: !4, line: 1, type: !16, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !3, retainedNodes: !2) |
| 88 |
!26 = !DILocalVariable(name: "a", arg: 1, scope: !25, file: !4, line: 1, type: !12) |
| 89 |
!27 = !DILocation(line: 1, column: 20, scope: !25) |
| 90 |
!28 = !DILocation(line: 2, column: 10, scope: !25) |