David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 1 | ; REQUIRES: object-emission |
| 2 | ; |
David Blaikie | 8300e12 | 2013-06-20 17:31:32 +0000 | [diff] [blame] | 3 | ; RUN: llc -mtriple=x86_64-unknown-linux-gnu -O0 -filetype=obj < %s > %t |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 4 | ; RUN: llvm-dwarfdump %t | FileCheck %s |
| 5 | |
| 6 | ; Test case derived from compiling the following source with clang -g: |
| 7 | ; |
| 8 | ; namespace pr14763 { |
| 9 | ; struct foo { |
| 10 | ; foo(const foo&); |
| 11 | ; }; |
| 12 | ; |
| 13 | ; foo func(foo f) { |
| 14 | ; return f; // reference 'f' for now because otherwise we hit another bug |
| 15 | ; } |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 16 | ; |
| 17 | ; void sink(void*); |
| 18 | ; |
| 19 | ; void func2(bool b, foo g) { |
| 20 | ; if (b) |
| 21 | ; sink(&g); // reference 'f' for now because otherwise we hit another bug |
| 22 | ; } |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 23 | ; } |
| 24 | |
| 25 | ; CHECK: debug_info contents |
Adrian Prantl | 418d1d1 | 2013-07-09 20:28:37 +0000 | [diff] [blame] | 26 | ; 0x74 is DW_OP_breg4, showing that the parameter is accessed indirectly |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 27 | ; (with a zero offset) from the register parameter |
Adrian Prantl | fb2add2 | 2016-02-29 19:49:46 +0000 | [diff] [blame] | 28 | ; CHECK: DW_AT_location [DW_FORM_data4] ([[F_LOC:0x[0-9]*]]) |
David Blaikie | eb1a272 | 2014-06-13 22:18:23 +0000 | [diff] [blame] | 29 | ; CHECK-NOT: DW_TAG |
| 30 | ; CHECK: DW_AT_name{{.*}} = "f" |
Adrian Prantl | fb2add2 | 2016-02-29 19:49:46 +0000 | [diff] [blame] | 31 | ; |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 32 | ; CHECK: DW_AT_location{{.*}}([[G_LOC:0x[0-9]*]]) |
David Blaikie | eb1a272 | 2014-06-13 22:18:23 +0000 | [diff] [blame] | 33 | ; CHECK-NOT: DW_TAG |
| 34 | ; CHECK: DW_AT_name{{.*}} = "g" |
Adrian Prantl | fb2add2 | 2016-02-29 19:49:46 +0000 | [diff] [blame] | 35 | ; |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 36 | ; CHECK: debug_loc contents |
Adrian Prantl | fb2add2 | 2016-02-29 19:49:46 +0000 | [diff] [blame] | 37 | ; CHECK: [[F_LOC]]: Beginning |
| 38 | ; CHECK-NEXT: Ending |
| 39 | ; CHECK-NEXT: Location description: 74 00 |
| 40 | ; CHECK: [[G_LOC]]: Beginning |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 41 | ; CHECK-NEXT: Ending |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 42 | ; CHECK-NEXT: Location description: 74 00 |
| 43 | |
| 44 | %"struct.pr14763::foo" = type { i8 } |
| 45 | |
| 46 | ; Function Attrs: uwtable |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 47 | define void @_ZN7pr147634funcENS_3fooE(%"struct.pr14763::foo"* noalias sret %agg.result, %"struct.pr14763::foo"* %f) #0 !dbg !4 { |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 48 | entry: |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 49 | call void @llvm.dbg.declare(metadata %"struct.pr14763::foo"* %f, metadata !22, metadata !DIExpression(DW_OP_deref)), !dbg !24 |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 50 | call void @_ZN7pr147633fooC1ERKS0_(%"struct.pr14763::foo"* %agg.result, %"struct.pr14763::foo"* %f), !dbg !25 |
| 51 | ret void, !dbg !25 |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 52 | } |
| 53 | |
| 54 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 55 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 56 | |
| 57 | declare void @_ZN7pr147633fooC1ERKS0_(%"struct.pr14763::foo"*, %"struct.pr14763::foo"*) #2 |
| 58 | |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 59 | ; Function Attrs: uwtable |
Peter Collingbourne | d4bff30 | 2015-11-05 22:03:56 +0000 | [diff] [blame] | 60 | define void @_ZN7pr147635func2EbNS_3fooE(i1 zeroext %b, %"struct.pr14763::foo"* %g) #0 !dbg !17 { |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 61 | entry: |
| 62 | %b.addr = alloca i8, align 1 |
| 63 | %frombool = zext i1 %b to i8 |
| 64 | store i8 %frombool, i8* %b.addr, align 1 |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 65 | call void @llvm.dbg.declare(metadata i8* %b.addr, metadata !26, metadata !DIExpression()), !dbg !27 |
| 66 | call void @llvm.dbg.declare(metadata %"struct.pr14763::foo"* %g, metadata !28, metadata !DIExpression(DW_OP_deref)), !dbg !27 |
David Blaikie | a79ac14 | 2015-02-27 21:17:42 +0000 | [diff] [blame] | 67 | %0 = load i8, i8* %b.addr, align 1, !dbg !29 |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 68 | %tobool = trunc i8 %0 to i1, !dbg !29 |
| 69 | br i1 %tobool, label %if.then, label %if.end, !dbg !29 |
| 70 | |
| 71 | if.then: ; preds = %entry |
| 72 | %1 = bitcast %"struct.pr14763::foo"* %g to i8*, !dbg !31 |
| 73 | call void @_ZN7pr147634sinkEPv(i8* %1), !dbg !31 |
| 74 | br label %if.end, !dbg !31 |
| 75 | |
| 76 | if.end: ; preds = %if.then, %entry |
| 77 | ret void, !dbg !32 |
| 78 | } |
| 79 | |
| 80 | declare void @_ZN7pr147634sinkEPv(i8*) #2 |
| 81 | |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 82 | attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 83 | attributes #1 = { nounwind readnone } |
| 84 | attributes #2 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf"="true" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" } |
| 85 | |
| 86 | !llvm.dbg.cu = !{!0} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 87 | !llvm.module.flags = !{!21, !33} |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 88 | |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 89 | !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 90 | !1 = !DIFile(filename: "pass.cpp", directory: "/tmp") |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 91 | !2 = !{} |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 92 | !4 = distinct !DISubprogram(name: "func", linkageName: "_ZN7pr147634funcENS_3fooE", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 6, file: !1, scope: !5, type: !6, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 93 | !5 = !DINamespace(name: "pr14763", line: 1, file: !1, scope: null) |
| 94 | !6 = !DISubroutineType(types: !7) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 95 | !7 = !{!8, !8} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 96 | !8 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 2, size: 8, align: 8, file: !1, scope: !5, elements: !9) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 97 | !9 = !{!10} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 98 | !10 = !DISubprogram(name: "foo", line: 3, isLocal: false, isDefinition: false, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !1, scope: !8, type: !11) |
| 99 | !11 = !DISubroutineType(types: !12) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 100 | !12 = !{null, !13, !14} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 101 | !13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial | DIFlagObjectPointer, baseType: !8) |
| 102 | !14 = !DIDerivedType(tag: DW_TAG_reference_type, baseType: !15) |
| 103 | !15 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !8) |
Adrian Prantl | 75819ae | 2016-04-15 15:57:41 +0000 | [diff] [blame] | 104 | !17 = distinct !DISubprogram(name: "func2", linkageName: "_ZN7pr147635func2EbNS_3fooE", line: 12, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 12, file: !1, scope: !5, type: !18, variables: !2) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 105 | !18 = !DISubroutineType(types: !19) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 106 | !19 = !{null, !20, !8} |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 107 | !20 = !DIBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean) |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame] | 108 | !21 = !{i32 2, !"Dwarf Version", i32 3} |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 109 | !22 = !DILocalVariable(name: "f", line: 6, arg: 1, scope: !4, file: !23, type: !8) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 110 | !23 = !DIFile(filename: "pass.cpp", directory: "/tmp") |
| 111 | !24 = !DILocation(line: 6, scope: !4) |
| 112 | !25 = !DILocation(line: 7, scope: !4) |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 113 | !26 = !DILocalVariable(name: "b", line: 12, arg: 1, scope: !17, file: !23, type: !20) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 114 | !27 = !DILocation(line: 12, scope: !17) |
Duncan P. N. Exon Smith | ed013cd | 2015-07-31 18:58:39 +0000 | [diff] [blame] | 115 | !28 = !DILocalVariable(name: "g", line: 12, arg: 2, scope: !17, file: !23, type: !8) |
Duncan P. N. Exon Smith | a9308c4 | 2015-04-29 16:38:44 +0000 | [diff] [blame] | 116 | !29 = !DILocation(line: 13, scope: !30) |
| 117 | !30 = distinct !DILexicalBlock(line: 13, column: 0, file: !1, scope: !17) |
| 118 | !31 = !DILocation(line: 14, scope: !30) |
| 119 | !32 = !DILocation(line: 15, scope: !17) |
Duncan P. N. Exon Smith | e274180 | 2015-03-03 17:24:31 +0000 | [diff] [blame] | 120 | !33 = !{i32 1, !"Debug Info Version", i32 3} |