David Blaikie | bb6a4e2 | 2014-06-05 00:51:35 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
| 2 | |
| 3 | ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s |
| 4 | |
| 5 | ; Built from the following source with clang -O1 |
| 6 | ; struct S { int i; }; |
| 7 | ; int function(struct S s, int i) { return s.i + i; } |
| 8 | |
| 9 | ; Due to the X86_64 ABI, 's' is passed in registers and once optimized, the |
| 10 | ; entirety of 's' is never reconstituted, since only the int is required, and |
| 11 | ; thus the variable's location is unknown/dead to debug info. |
| 12 | |
| 13 | ; Future/current work should enable us to describe partial variables, which, in |
| 14 | ; this case, happens to be the entire variable. |
| 15 | |
| 16 | ; CHECK: DW_TAG_subprogram |
| 17 | ; CHECK-NOT: DW_TAG |
| 18 | ; CHECK: DW_AT_name {{.*}} "function" |
| 19 | ; CHECK-NOT: {{DW_TAG|NULL}} |
| 20 | ; CHECK: DW_TAG_formal_parameter |
| 21 | ; CHECK-NOT: DW_TAG |
| 22 | ; CHECK: DW_AT_name {{.*}} "s" |
| 23 | ; CHECK-NOT: DW_TAG |
| 24 | ; FIXME: Even though 's' is never reconstituted into a struct, the one member |
| 25 | ; variable is still live and used, and so we should be able to describe 's's |
| 26 | ; location as the location of that int. |
| 27 | ; CHECK-NOT: DW_AT_location |
| 28 | ; CHECK-NOT: {{DW_TAG|NULL}} |
| 29 | ; CHECK: DW_TAG_formal_parameter |
| 30 | ; CHECK-NOT: DW_TAG |
David Blaikie | bb6a4e2 | 2014-06-05 00:51:35 +0000 | [diff] [blame] | 31 | ; CHECK: DW_AT_location |
David Blaikie | eb1a272 | 2014-06-13 22:18:23 +0000 | [diff] [blame] | 32 | ; CHECK-NOT: DW_TAG |
| 33 | ; CHECK: DW_AT_name {{.*}} "i" |
David Blaikie | bb6a4e2 | 2014-06-05 00:51:35 +0000 | [diff] [blame] | 34 | |
| 35 | |
| 36 | %struct.S = type { i32 } |
| 37 | |
| 38 | ; Function Attrs: nounwind readnone uwtable |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame^] | 39 | define i32 @_Z8function1Si(i32 %s.coerce, i32 %i) #0 !dbg !9 { |
David Blaikie | bb6a4e2 | 2014-06-05 00:51:35 +0000 | [diff] [blame] | 40 | entry: |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 41 | tail call void @llvm.dbg.declare(metadata %struct.S* undef, metadata !14, metadata !DIExpression()), !dbg !20 |
| 42 | tail call void @llvm.dbg.value(metadata i32 %i, i64 0, metadata !15, metadata !DIExpression()), !dbg !20 |
David Blaikie | bb6a4e2 | 2014-06-05 00:51:35 +0000 | [diff] [blame] | 43 | %add = add nsw i32 %i, %s.coerce, !dbg !20 |
| 44 | ret i32 %add, !dbg !20 |
| 45 | } |
| 46 | |
| 47 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 48 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
David Blaikie | bb6a4e2 | 2014-06-05 00:51:35 +0000 | [diff] [blame] | 49 | |
| 50 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 51 | declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 |
David Blaikie | bb6a4e2 | 2014-06-05 00:51:35 +0000 | [diff] [blame] | 52 | |
| 53 | attributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 54 | attributes #1 = { nounwind readnone } |
| 55 | |
| 56 | !llvm.dbg.cu = !{!0} |
| 57 | !llvm.module.flags = !{!16, !17} |
| 58 | !llvm.ident = !{!18} |
| 59 | |
Duncan P. N. Exon Smith | 55ca964 | 2015-08-03 17:26:41 +0000 | [diff] [blame] | 60 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: true, emissionKind: 1, file: !1, enums: !2, retainedTypes: !3, subprograms: !8, globals: !2, imports: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 61 | !1 = !DIFile(filename: "dead-argument-order.cpp", directory: "/tmp/dbginfo") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 62 | !2 = !{} |
| 63 | !3 = !{!4} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 64 | !4 = !DICompositeType(tag: DW_TAG_structure_type, name: "S", line: 1, size: 32, align: 32, file: !1, elements: !5, identifier: "_ZTS1S") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 65 | !5 = !{!6} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 66 | !6 = !DIDerivedType(tag: DW_TAG_member, name: "i", line: 1, size: 32, align: 32, file: !1, scope: !"_ZTS1S", baseType: !7) |
| 67 | !7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 68 | !8 = !{!9} |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame^] | 69 | !9 = distinct !DISubprogram(name: "function", linkageName: "_Z8function1Si", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, scopeLine: 2, file: !1, scope: !10, type: !11, variables: !13) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 70 | !10 = !DIFile(filename: "dead-argument-order.cpp", directory: "/tmp/dbginfo") |
| 71 | !11 = !DISubroutineType(types: !12) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 72 | !12 = !{!7, !4, !7} |
| 73 | !13 = !{!14, !15} |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 74 | !14 = !DILocalVariable(name: "s", line: 2, arg: 1, scope: !9, file: !10, type: !"_ZTS1S") |
| 75 | !15 = !DILocalVariable(name: "i", line: 2, arg: 2, scope: !9, file: !10, type: !7) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 76 | !16 = !{i32 2, !"Dwarf Version", i32 4} |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 77 | !17 = !{i32 2, !"Debug Info Version", i32 3} |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 78 | !18 = !{!"clang version 3.5.0 "} |
| 79 | !19 = !{%struct.S* undef} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 80 | !20 = !DILocation(line: 2, scope: !9) |
David Blaikie | bb6a4e2 | 2014-06-05 00:51:35 +0000 | [diff] [blame] | 81 | |