xref: /aosp_15_r20/external/llvm/test/DebugInfo/X86/union-template.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O0 -mtriple=x86_64-linux-gnu %s -o %t -filetype=obj
2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker; Verify that we've emitted template arguments for the union
5*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_union_type
6*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: "Value<float>"
7*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_template_type_parameter
8*9880d681SAndroid Build Coastguard Worker; CHECK: "T"
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker%"union.PR15637::Value" = type { i32 }
11*9880d681SAndroid Build Coastguard Worker
12*9880d681SAndroid Build Coastguard Worker@_ZN7PR156371fE = global %"union.PR15637::Value" zeroinitializer, align 4
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Workerdefine void @_ZN7PR156371gEf(float %value) #0 !dbg !4 {
15*9880d681SAndroid Build Coastguard Workerentry:
16*9880d681SAndroid Build Coastguard Worker  %value.addr = alloca float, align 4
17*9880d681SAndroid Build Coastguard Worker  %tempValue = alloca %"union.PR15637::Value", align 4
18*9880d681SAndroid Build Coastguard Worker  store float %value, float* %value.addr, align 4
19*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata float* %value.addr, metadata !23, metadata !DIExpression()), !dbg !24
20*9880d681SAndroid Build Coastguard Worker  call void @llvm.dbg.declare(metadata %"union.PR15637::Value"* %tempValue, metadata !25, metadata !DIExpression()), !dbg !26
21*9880d681SAndroid Build Coastguard Worker  ret void, !dbg !27
22*9880d681SAndroid Build Coastguard Worker}
23*9880d681SAndroid Build Coastguard Worker
24*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind }
27*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone }
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0}
30*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!28}
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.3 (trunk 178499) (llvm/trunk 178472)", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !9, imports:  !2)
33*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "foo.cc", directory: "/usr/local/google/home/echristo/tmp")
34*9880d681SAndroid Build Coastguard Worker!2 = !{}
35*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "g", linkageName: "_ZN7PR156371gEf", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, variables: !2)
36*9880d681SAndroid Build Coastguard Worker!5 = !DINamespace(name: "PR15637", line: 1, file: !1, scope: null)
37*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7)
38*9880d681SAndroid Build Coastguard Worker!7 = !{null, !8}
39*9880d681SAndroid Build Coastguard Worker!8 = !DIBasicType(tag: DW_TAG_base_type, name: "float", size: 32, align: 32, encoding: DW_ATE_float)
40*9880d681SAndroid Build Coastguard Worker!9 = !{!10}
41*9880d681SAndroid Build Coastguard Worker!10 = !DIGlobalVariable(name: "f", linkageName: "_ZN7PR156371fE", line: 6, isLocal: false, isDefinition: true, scope: !5, file: !11, type: !12, variable: %"union.PR15637::Value"* @_ZN7PR156371fE)
42*9880d681SAndroid Build Coastguard Worker!11 = !DIFile(filename: "foo.cc", directory: "/usr/local/google/home/echristo/tmp")
43*9880d681SAndroid Build Coastguard Worker!12 = !DICompositeType(tag: DW_TAG_union_type, name: "Value<float>", line: 2, size: 32, align: 32, file: !1, scope: !5, elements: !13, templateParams: !21)
44*9880d681SAndroid Build Coastguard Worker!13 = !{!14, !16}
45*9880d681SAndroid Build Coastguard Worker!14 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 2, size: 32, align: 32, file: !1, scope: !12, baseType: !15)
46*9880d681SAndroid Build Coastguard Worker!15 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
47*9880d681SAndroid Build Coastguard Worker!16 = !DISubprogram(name: "Value", line: 2, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false, scopeLine: 2, file: !1, scope: !12, type: !17)
48*9880d681SAndroid Build Coastguard Worker!17 = !DISubroutineType(types: !18)
49*9880d681SAndroid Build Coastguard Worker!18 = !{null, !19}
50*9880d681SAndroid Build Coastguard Worker!19 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !12)
51*9880d681SAndroid Build Coastguard Worker!21 = !{!22}
52*9880d681SAndroid Build Coastguard Worker!22 = !DITemplateTypeParameter(name: "T", type: !8)
53*9880d681SAndroid Build Coastguard Worker!23 = !DILocalVariable(name: "value", line: 3, arg: 1, scope: !4, file: !11, type: !8)
54*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 3, scope: !4)
55*9880d681SAndroid Build Coastguard Worker!25 = !DILocalVariable(name: "tempValue", line: 4, scope: !4, file: !11, type: !12)
56*9880d681SAndroid Build Coastguard Worker!26 = !DILocation(line: 4, scope: !4)
57*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 5, scope: !4)
58*9880d681SAndroid Build Coastguard Worker!28 = !{i32 1, !"Debug Info Version", i32 3}
59