blob: 68a211fcecc338404392d29232992bad4f16781f [file] [log] [blame]
David Blaikied8f0ac72014-04-28 20:27:02 +00001; REQUIRES: object-emission
2
3; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s
4
5; From source:
6; struct foo {
7; int __attribute__((always_inline)) func(int x) { return x + 2; }
8; };
9
10; int i;
11
12; int main() {
13; return foo().func(i);
14; }
15
David Blaikie3c2fff32014-05-27 18:37:48 +000016; CHECK: DW_TAG_structure_type
17; CHECK: DW_TAG_subprogram
18
19; But make sure we emit DW_AT_object_pointer on the abstract definition.
20; CHECK: [[ABSTRACT_ORIGIN:.*]]: DW_TAG_subprogram
Frederic Rissd1cfc3c2014-10-06 03:36:31 +000021; CHECK-NOT: {{NULL|TAG}}
22; CHECK: DW_AT_specification {{.*}} "_ZN3foo4funcEi"
23; CHECK-NOT: {{NULL|TAG}}
David Blaikie3c2fff32014-05-27 18:37:48 +000024; CHECK: DW_AT_object_pointer
25
David Blaikied8f0ac72014-04-28 20:27:02 +000026; Ensure we omit DW_AT_object_pointer on inlined subroutines.
27; CHECK: DW_TAG_inlined_subroutine
Frederic Rissd1cfc3c2014-10-06 03:36:31 +000028; CHECK-NEXT: DW_AT_abstract_origin {{.*}} {[[ABSTRACT_ORIGIN]]} "_ZN3foo4funcEi"
David Blaikied8f0ac72014-04-28 20:27:02 +000029; CHECK-NOT: NULL
30; CHECK-NOT: DW_AT_object_pointer
David Blaikie44078b32014-04-30 22:41:33 +000031; CHECK: DW_TAG_formal_parameter
32; CHECK-NOT: DW_AT_artificial
David Blaikied8f0ac72014-04-28 20:27:02 +000033; CHECK: DW_TAG
34
David Blaikied8f0ac72014-04-28 20:27:02 +000035%struct.foo = type { i8 }
36
37@i = global i32 0, align 4
38
39; Function Attrs: uwtable
40define i32 @main() #0 {
41entry:
42 %this.addr.i = alloca %struct.foo*, align 8
43 %x.addr.i = alloca i32, align 4
44 %retval = alloca i32, align 4
45 %tmp = alloca %struct.foo, align 1
46 store i32 0, i32* %retval
47 %0 = load i32* @i, align 4, !dbg !23
48 store %struct.foo* %tmp, %struct.foo** %this.addr.i, align 8
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000049 call void @llvm.dbg.declare(metadata %struct.foo** %this.addr.i, metadata !24, metadata !{!"0x102"}), !dbg !26
David Blaikied8f0ac72014-04-28 20:27:02 +000050 store i32 %0, i32* %x.addr.i, align 4
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000051 call void @llvm.dbg.declare(metadata i32* %x.addr.i, metadata !27, metadata !{!"0x102"}), !dbg !28
David Blaikied8f0ac72014-04-28 20:27:02 +000052 %this1.i = load %struct.foo** %this.addr.i
53 %1 = load i32* %x.addr.i, align 4, !dbg !28
54 %add.i = add nsw i32 %1, 2, !dbg !28
55 ret i32 %add.i, !dbg !23
56}
57
58; Function Attrs: nounwind readnone
Adrian Prantl87b7eb92014-10-01 18:55:02 +000059declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
David Blaikied8f0ac72014-04-28 20:27:02 +000060
61attributes #0 = { uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
62attributes #1 = { nounwind readnone }
63
64!llvm.dbg.cu = !{!0}
65!llvm.module.flags = !{!20, !21}
66!llvm.ident = !{!22}
67
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000068!0 = !{!"0x11\004\00clang version 3.5.0 \000\00\000\00\001", !1, !2, !3, !12, !18, !2} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/inline.cpp] [DW_LANG_C_plus_plus]
69!1 = !{!"inline.cpp", !"/tmp/dbginfo"}
70!2 = !{}
71!3 = !{!4}
72!4 = !{!"0x13\00foo\001\008\008\000\000\000", !1, null, null, !5, null, null, !"_ZTS3foo"} ; [ DW_TAG_structure_type ] [foo] [line 1, size 8, align 8, offset 0] [def] [from ]
73!5 = !{!6}
74!6 = !{!"0x2e\00func\00func\00_ZN3foo4funcEi\002\000\000\000\006\00256\000\002", !1, !"_ZTS3foo", !7, null, null, null, i32 0, !11} ; [ DW_TAG_subprogram ] [line 2] [func]
75!7 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
76!8 = !{!9, !10, !9}
77!9 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
78!10 = !{!"0xf\00\000\0064\0064\000\001088", null, null, !"_ZTS3foo"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [artificial] [from _ZTS3foo]
79!11 = !{i32 786468}
80!12 = !{!13, !17}
81!13 = !{!"0x2e\00main\00main\00\007\000\001\000\006\00256\000\007", !1, !14, !15, null, i32 ()* @main, null, null, !2} ; [ DW_TAG_subprogram ] [line 7] [def] [main]
82!14 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [/tmp/dbginfo/inline.cpp]
83!15 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !16, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
84!16 = !{!9}
85!17 = !{!"0x2e\00func\00func\00_ZN3foo4funcEi\002\000\001\000\006\00256\000\002", !1, !"_ZTS3foo", !7, null, null, null, !6, !2} ; [ DW_TAG_subprogram ] [line 2] [def] [func]
86!18 = !{!19}
87!19 = !{!"0x34\00i\00i\00\005\000\001", null, !14, !9, i32* @i, null} ; [ DW_TAG_variable ] [i] [line 5] [def]
88!20 = !{i32 2, !"Dwarf Version", i32 4}
89!21 = !{i32 1, !"Debug Info Version", i32 2}
90!22 = !{!"clang version 3.5.0 "}
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000091!23 = !MDLocation(line: 8, scope: !13)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000092!24 = !{!"0x101\00this\0016777216\001088", !17, null, !25} ; [ DW_TAG_arg_variable ] [this] [line 0]
93!25 = !{!"0xf\00\000\0064\0064\000\000", null, null, !"_ZTS3foo"} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from _ZTS3foo]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000094!26 = !MDLocation(line: 0, scope: !17, inlinedAt: !23)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000095!27 = !{!"0x101\00x\0033554434\000", !17, !14, !9} ; [ DW_TAG_arg_variable ] [x] [line 2]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +000096!28 = !MDLocation(line: 2, scope: !17, inlinedAt: !23)