Eric Christopher | 6476f90 | 2013-04-02 22:55:56 +0000 | [diff] [blame] | 1 | ; RUN: llc -O0 -mtriple=x86_64-linux-gnu %s -o %t -filetype=obj |
Adrian Prantl | 7bc1b28 | 2017-09-11 22:59:45 +0000 | [diff] [blame] | 2 | ; RUN: llvm-dwarfdump -debug-info %t | FileCheck %s |
Eric Christopher | 6476f90 | 2013-04-02 22:55:56 +0000 | [diff] [blame] | 3 | |
| 4 | ; Verify that we've emitted template arguments for the union |
| 5 | ; CHECK: DW_TAG_union_type |
| 6 | ; CHECK-NEXT: "Value<float>" |
| 7 | ; CHECK: DW_TAG_template_type_parameter |
| 8 | ; CHECK: "T" |
| 9 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 10 | source_filename = "test/DebugInfo/X86/union-template.ll" |
| 11 | |
Eric Christopher | 6476f90 | 2013-04-02 22:55:56 +0000 | [diff] [blame] | 12 | %"union.PR15637::Value" = type { i32 } |
| 13 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 14 | @_ZN7PR156371fE = global %"union.PR15637::Value" zeroinitializer, align 4, !dbg !0 |
Eric Christopher | 6476f90 | 2013-04-02 22:55:56 +0000 | [diff] [blame] | 15 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 16 | ; Function Attrs: nounwind |
| 17 | define void @_ZN7PR156371gEf(float %value) #0 !dbg !19 { |
Eric Christopher | 6476f90 | 2013-04-02 22:55:56 +0000 | [diff] [blame] | 18 | entry: |
| 19 | %value.addr = alloca float, align 4 |
| 20 | %tempValue = alloca %"union.PR15637::Value", align 4 |
| 21 | store float %value, float* %value.addr, align 4 |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 22 | call void @llvm.dbg.declare(metadata float* %value.addr, metadata !22, metadata !23), !dbg !24 |
| 23 | call void @llvm.dbg.declare(metadata %"union.PR15637::Value"* %tempValue, metadata !25, metadata !23), !dbg !26 |
Eric Christopher | 6476f90 | 2013-04-02 22:55:56 +0000 | [diff] [blame] | 24 | ret void, !dbg !27 |
| 25 | } |
| 26 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 27 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 28 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
Eric Christopher | 6476f90 | 2013-04-02 22:55:56 +0000 | [diff] [blame] | 29 | |
| 30 | attributes #0 = { nounwind } |
| 31 | attributes #1 = { nounwind readnone } |
| 32 | |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 33 | !llvm.dbg.cu = !{!15} |
| 34 | !llvm.module.flags = !{!18} |
Eric Christopher | 6476f90 | 2013-04-02 22:55:56 +0000 | [diff] [blame] | 35 | |
Adrian Prantl | 0578221 | 2017-08-30 18:06:51 +0000 | [diff] [blame] | 36 | !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 37 | !1 = !DIGlobalVariable(name: "f", linkageName: "_ZN7PR156371fE", scope: !2, file: !3, line: 6, type: !4, isLocal: false, isDefinition: true) |
Adrian Prantl | fed4f39 | 2017-04-28 22:25:46 +0000 | [diff] [blame] | 38 | !2 = !DINamespace(name: "PR15637", scope: null) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 39 | !3 = !DIFile(filename: "foo.cc", directory: "/usr/local/google/home/echristo/tmp") |
| 40 | !4 = !DICompositeType(tag: DW_TAG_union_type, name: "Value<float>", scope: !2, file: !3, line: 2, size: 32, align: 32, elements: !5, templateParams: !12) |
| 41 | !5 = !{!6, !8} |
| 42 | !6 = !DIDerivedType(tag: DW_TAG_member, name: "a", scope: !4, file: !3, line: 2, baseType: !7, size: 32, align: 32) |
| 43 | !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
| 44 | !8 = !DISubprogram(name: "Value", scope: !4, file: !3, line: 2, type: !9, isLocal: false, isDefinition: false, scopeLine: 2, virtualIndex: 6, flags: DIFlagArtificial | DIFlagPrototyped, isOptimized: false) |
| 45 | !9 = !DISubroutineType(types: !10) |
| 46 | !10 = !{null, !11} |
| 47 | !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !4, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer) |
| 48 | !12 = !{!13} |
| 49 | !13 = !DITemplateTypeParameter(name: "T", type: !14) |
| 50 | !14 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float) |
| 51 | !15 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3 (trunk 178499) (llvm/trunk 178472)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !16, retainedTypes: !16, globals: !17, imports: !16) |
| 52 | !16 = !{} |
| 53 | !17 = !{!0} |
| 54 | !18 = !{i32 1, !"Debug Info Version", i32 3} |
Shiva Chen | 2c86455 | 2018-05-09 02:40:45 +0000 | [diff] [blame] | 55 | !19 = distinct !DISubprogram(name: "g", linkageName: "_ZN7PR156371gEf", scope: !2, file: !3, line: 3, type: !20, isLocal: false, isDefinition: true, scopeLine: 3, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !15, retainedNodes: !16) |
Adrian Prantl | 1eadba1 | 2016-12-22 00:45:21 +0000 | [diff] [blame] | 56 | !20 = !DISubroutineType(types: !21) |
| 57 | !21 = !{null, !14} |
| 58 | !22 = !DILocalVariable(name: "value", arg: 1, scope: !19, file: !3, line: 3, type: !14) |
| 59 | !23 = !DIExpression() |
| 60 | !24 = !DILocation(line: 3, scope: !19) |
| 61 | !25 = !DILocalVariable(name: "tempValue", scope: !19, file: !3, line: 4, type: !4) |
| 62 | !26 = !DILocation(line: 4, scope: !19) |
| 63 | !27 = !DILocation(line: 5, scope: !19) |
| 64 | |