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 | 418d1d1 | 2013-07-09 20:28:37 +0000 | [diff] [blame] | 28 | ; CHECK: DW_AT_location{{.*}}(<0x0{{.}}> 74 00 |
David Blaikie | eb1a272 | 2014-06-13 22:18:23 +0000 | [diff] [blame] | 29 | ; CHECK-NOT: DW_TAG |
| 30 | ; CHECK: DW_AT_name{{.*}} = "f" |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +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" |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 35 | ; CHECK: debug_loc contents |
| 36 | ; CHECK-NEXT: [[G_LOC]]: Beginning |
| 37 | ; CHECK-NEXT: Ending |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 38 | ; CHECK-NEXT: Location description: 74 00 |
| 39 | |
| 40 | %"struct.pr14763::foo" = type { i8 } |
| 41 | |
| 42 | ; Function Attrs: uwtable |
| 43 | define void @_ZN7pr147634funcENS_3fooE(%"struct.pr14763::foo"* noalias sret %agg.result, %"struct.pr14763::foo"* %f) #0 { |
| 44 | entry: |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 45 | call void @llvm.dbg.declare(metadata %"struct.pr14763::foo"* %f, metadata !22, metadata !{!"0x102"}), !dbg !24 |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 46 | call void @_ZN7pr147633fooC1ERKS0_(%"struct.pr14763::foo"* %agg.result, %"struct.pr14763::foo"* %f), !dbg !25 |
| 47 | ret void, !dbg !25 |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 48 | } |
| 49 | |
| 50 | ; Function Attrs: nounwind readnone |
Adrian Prantl | 87b7eb9 | 2014-10-01 18:55:02 +0000 | [diff] [blame] | 51 | declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 52 | |
| 53 | declare void @_ZN7pr147633fooC1ERKS0_(%"struct.pr14763::foo"*, %"struct.pr14763::foo"*) #2 |
| 54 | |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 55 | ; Function Attrs: uwtable |
| 56 | define void @_ZN7pr147635func2EbNS_3fooE(i1 zeroext %b, %"struct.pr14763::foo"* %g) #0 { |
| 57 | entry: |
| 58 | %b.addr = alloca i8, align 1 |
| 59 | %frombool = zext i1 %b to i8 |
| 60 | store i8 %frombool, i8* %b.addr, align 1 |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 61 | call void @llvm.dbg.declare(metadata i8* %b.addr, metadata !26, metadata !{!"0x102"}), !dbg !27 |
| 62 | call void @llvm.dbg.declare(metadata %"struct.pr14763::foo"* %g, metadata !28, metadata !{!"0x102"}), !dbg !27 |
David Blaikie | ea2605d | 2013-06-20 00:25:24 +0000 | [diff] [blame] | 63 | %0 = load i8* %b.addr, align 1, !dbg !29 |
| 64 | %tobool = trunc i8 %0 to i1, !dbg !29 |
| 65 | br i1 %tobool, label %if.then, label %if.end, !dbg !29 |
| 66 | |
| 67 | if.then: ; preds = %entry |
| 68 | %1 = bitcast %"struct.pr14763::foo"* %g to i8*, !dbg !31 |
| 69 | call void @_ZN7pr147634sinkEPv(i8* %1), !dbg !31 |
| 70 | br label %if.end, !dbg !31 |
| 71 | |
| 72 | if.end: ; preds = %if.then, %entry |
| 73 | ret void, !dbg !32 |
| 74 | } |
| 75 | |
| 76 | declare void @_ZN7pr147634sinkEPv(i8*) #2 |
| 77 | |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 78 | 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" } |
| 79 | attributes #1 = { nounwind readnone } |
| 80 | 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" } |
| 81 | |
| 82 | !llvm.dbg.cu = !{!0} |
Manman Ren | 409558f | 2013-11-22 21:49:45 +0000 | [diff] [blame] | 83 | !llvm.module.flags = !{!21, !33} |
David Blaikie | 81a4dc7 | 2013-06-19 21:55:13 +0000 | [diff] [blame] | 84 | |
Duncan P. N. Exon Smith | be7ea19 | 2014-12-15 19:07:53 +0000 | [diff] [blame^] | 85 | !0 = !{!"0x11\004\00clang version 3.4 \000\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/tmp/pass.cpp] [DW_LANG_C_plus_plus] |
| 86 | !1 = !{!"pass.cpp", !"/tmp"} |
| 87 | !2 = !{} |
| 88 | !3 = !{!4, !17} |
| 89 | !4 = !{!"0x2e\00func\00func\00_ZN7pr147634funcENS_3fooE\006\000\001\000\006\00256\000\006", !1, !5, !6, null, void (%"struct.pr14763::foo"*, %"struct.pr14763::foo"*)* @_ZN7pr147634funcENS_3fooE, null, null, !2} ; [ DW_TAG_subprogram ] [line 6] [def] [func] |
| 90 | !5 = !{!"0x39\00pr14763\001", !1, null} ; [ DW_TAG_namespace ] [pr14763] [line 1] |
| 91 | !6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 92 | !7 = !{!8, !8} |
| 93 | !8 = !{!"0x13\00foo\002\008\008\000\000\000", !1, !5, null, !9, null, null, null} ; [ DW_TAG_structure_type ] [foo] [line 2, size 8, align 8, offset 0] [def] [from ] |
| 94 | !9 = !{!10} |
| 95 | !10 = !{!"0x2e\00foo\00foo\00\003\000\000\000\006\00256\000\003", !1, !8, !11, null, null, null, i32 0, !16} ; [ DW_TAG_subprogram ] [line 3] [foo] |
| 96 | !11 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !12, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 97 | !12 = !{null, !13, !14} |
| 98 | !13 = !{!"0xf\00\000\0064\0064\000\001088", i32 0, null, !8} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from foo] |
| 99 | !14 = !{!"0x10\00\000\000\000\000\000", null, null, !15} ; [ DW_TAG_reference_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 100 | !15 = !{!"0x26\00\000\000\000\000\000", null, null, !8} ; [ DW_TAG_const_type ] [line 0, size 0, align 0, offset 0] [from foo] |
| 101 | !16 = !{i32 786468} |
| 102 | !17 = !{!"0x2e\00func2\00func2\00_ZN7pr147635func2EbNS_3fooE\0012\000\001\000\006\00256\000\0012", !1, !5, !18, null, void (i1, %"struct.pr14763::foo"*)* @_ZN7pr147635func2EbNS_3fooE, null, null, !2} ; [ DW_TAG_subprogram ] [line 12] [def] [func2] |
| 103 | !18 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !19, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ] |
| 104 | !19 = !{null, !20, !8} |
| 105 | !20 = !{!"0x24\00bool\000\008\008\000\000\002", null, null} ; [ DW_TAG_base_type ] [bool] [line 0, size 8, align 8, offset 0, enc DW_ATE_boolean] |
| 106 | !21 = !{i32 2, !"Dwarf Version", i32 3} |
| 107 | !22 = !{!"0x101\00f\0016777222\008192", !4, !23, !8} ; [ DW_TAG_arg_variable ] [f] [line 6] |
| 108 | !23 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [/tmp/pass.cpp] |
| 109 | !24 = !{i32 6, i32 0, !4, null} |
| 110 | !25 = !{i32 7, i32 0, !4, null} |
| 111 | !26 = !{!"0x101\00b\0016777228\000", !17, !23, !20} ; [ DW_TAG_arg_variable ] [b] [line 12] |
| 112 | !27 = !{i32 12, i32 0, !17, null} |
| 113 | !28 = !{!"0x101\00g\0033554444\008192", !17, !23, !8} ; [ DW_TAG_arg_variable ] [g] [line 12] |
| 114 | !29 = !{i32 13, i32 0, !30, null} |
| 115 | !30 = !{!"0xb\0013\000\000", !1, !17} ; [ DW_TAG_lexical_block ] [/tmp/pass.cpp] |
| 116 | !31 = !{i32 14, i32 0, !30, null} |
| 117 | !32 = !{i32 15, i32 0, !17, null} |
| 118 | !33 = !{i32 1, !"Debug Info Version", i32 2} |