1 ; RUN: llc -O0 %s -o - -filetype=obj \
2 ; RUN: | llvm-dwarfdump -statistics - | FileCheck %s
4 ; This checks that if DW_TAG_structure_type duplicates in multiple CU,
5 ; the number of total vars ("source variables") will include every copy,
6 ; so the number of "variables with location" doesn't exceed the number of total vars.
9 ; struct s { static const int ss = 42; };
19 ; CHECK: "#source variables": 4,
20 ; CHECK: "#source variables with location": 4,
22 source_filename = "llvm-link"
23 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
24 target triple = "x86_64-unknown-linux-gnu"
26 %struct.s = type { i8 }
27 %struct.s.1 = type { i8 }
29 @S1 = dso_local global %struct.s zeroinitializer, align 1, !dbg !0
30 @S2 = dso_local global %struct.s.1 zeroinitializer, align 1, !dbg !13
32 !llvm.dbg.cu = !{!2, !15}
33 !llvm.ident = !{!18, !18}
34 !llvm.module.flags = !{!19, !20, !21}
36 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
37 !1 = distinct !DIGlobalVariable(name: "S1", scope: !2, file: !3, line: 2, type: !6, isLocal: false, isDefinition: true)
38 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !3, producer: "clang version 10.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !5, globals: !12, splitDebugInlining: false, nameTableKind: None)
39 !3 = !DIFile(filename: "test1.cpp", directory: "/")
42 !6 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s", file: !7, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !8, identifier: "_ZTS1s")
43 !7 = !DIFile(filename: "./test.h", directory: "/")
45 !9 = !DIDerivedType(tag: DW_TAG_member, name: "ss", scope: !6, file: !7, line: 1, baseType: !10, flags: DIFlagStaticMember, extraData: i32 42)
46 !10 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !11)
47 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
49 !13 = !DIGlobalVariableExpression(var: !14, expr: !DIExpression())
50 !14 = distinct !DIGlobalVariable(name: "S2", scope: !15, file: !16, line: 2, type: !6, isLocal: false, isDefinition: true)
51 !15 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !16, producer: "clang version 10.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, retainedTypes: !22, globals: !17, splitDebugInlining: false, nameTableKind: None)
52 !16 = !DIFile(filename: "test2.cpp", directory: "/")
54 !18 = !{!"clang version 10.0.0"}
55 !19 = !{i32 7, !"Dwarf Version", i32 4}
56 !20 = !{i32 2, !"Debug Info Version", i32 3}
57 !21 = !{i32 1, !"wchar_size", i32 4}
59 !23 = distinct !DICompositeType(tag: DW_TAG_structure_type, name: "s", file: !7, line: 1, size: 8, flags: DIFlagTypePassByValue, elements: !24, identifier: "_ZTS1s")
61 !25 = !DIDerivedType(tag: DW_TAG_member, name: "ss", scope: !23, file: !7, line: 1, baseType: !10, flags: DIFlagStaticMember, extraData: i32 42)