blob: d5ecf8157e51f4ed51cdc30f53ce643e6c724dea [file] [log] [blame]
Manman Rened696c32013-07-24 22:23:00 +00001; RUN: llc -mtriple=x86_64-apple-macosx10.7 %s -o %t -filetype=obj
Eli Benderskye6abe832013-01-25 21:44:53 +00002; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
Eric Christopher27886c62011-12-16 23:42:45 +00003
4; CHECK: b_ref
5; CHECK-NOT: AT_bit_size
6
7%struct.bar = type { %struct.baz, %struct.baz* }
8%struct.baz = type { i32 }
9
10define i32 @main(i32 %argc, i8** %argv) uwtable ssp {
11entry:
12 %retval = alloca i32, align 4
13 %argc.addr = alloca i32, align 4
14 %argv.addr = alloca i8**, align 8
15 %myBar = alloca %struct.bar, align 8
16 store i32 0, i32* %retval
17 store i32 %argc, i32* %argc.addr, align 4
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000018 call void @llvm.dbg.declare(metadata i32* %argc.addr, metadata !49, metadata !{!"0x102"}), !dbg !50
Eric Christopher27886c62011-12-16 23:42:45 +000019 store i8** %argv, i8*** %argv.addr, align 8
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000020 call void @llvm.dbg.declare(metadata i8*** %argv.addr, metadata !51, metadata !{!"0x102"}), !dbg !52
21 call void @llvm.dbg.declare(metadata %struct.bar* %myBar, metadata !53, metadata !{!"0x102"}), !dbg !55
Eric Christopher27886c62011-12-16 23:42:45 +000022 call void @_ZN3barC1Ei(%struct.bar* %myBar, i32 1), !dbg !56
23 ret i32 0, !dbg !57
24}
25
Adrian Prantl87b7eb92014-10-01 18:55:02 +000026declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
Eric Christopher27886c62011-12-16 23:42:45 +000027
28define linkonce_odr void @_ZN3barC1Ei(%struct.bar* %this, i32 %x) unnamed_addr uwtable ssp align 2 {
29entry:
30 %this.addr = alloca %struct.bar*, align 8
31 %x.addr = alloca i32, align 4
32 store %struct.bar* %this, %struct.bar** %this.addr, align 8
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000033 call void @llvm.dbg.declare(metadata %struct.bar** %this.addr, metadata !58, metadata !{!"0x102"}), !dbg !59
Eric Christopher27886c62011-12-16 23:42:45 +000034 store i32 %x, i32* %x.addr, align 4
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000035 call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !60, metadata !{!"0x102"}), !dbg !61
David Blaikiea79ac142015-02-27 21:17:42 +000036 %this1 = load %struct.bar*, %struct.bar** %this.addr
37 %0 = load i32, i32* %x.addr, align 4, !dbg !62
Eric Christopher27886c62011-12-16 23:42:45 +000038 call void @_ZN3barC2Ei(%struct.bar* %this1, i32 %0), !dbg !62
39 ret void, !dbg !62
40}
41
42define linkonce_odr void @_ZN3barC2Ei(%struct.bar* %this, i32 %x) unnamed_addr uwtable ssp align 2 {
43entry:
44 %this.addr = alloca %struct.bar*, align 8
45 %x.addr = alloca i32, align 4
46 store %struct.bar* %this, %struct.bar** %this.addr, align 8
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000047 call void @llvm.dbg.declare(metadata %struct.bar** %this.addr, metadata !63, metadata !{!"0x102"}), !dbg !64
Eric Christopher27886c62011-12-16 23:42:45 +000048 store i32 %x, i32* %x.addr, align 4
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000049 call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !65, metadata !{!"0x102"}), !dbg !66
David Blaikiea79ac142015-02-27 21:17:42 +000050 %this1 = load %struct.bar*, %struct.bar** %this.addr
David Blaikie79e6c742015-02-27 19:29:02 +000051 %b = getelementptr inbounds %struct.bar, %struct.bar* %this1, i32 0, i32 0, !dbg !67
David Blaikiea79ac142015-02-27 21:17:42 +000052 %0 = load i32, i32* %x.addr, align 4, !dbg !67
Eric Christopher27886c62011-12-16 23:42:45 +000053 call void @_ZN3bazC1Ei(%struct.baz* %b, i32 %0), !dbg !67
David Blaikie79e6c742015-02-27 19:29:02 +000054 %1 = getelementptr inbounds %struct.bar, %struct.bar* %this1, i32 0, i32 1, !dbg !67
55 %b2 = getelementptr inbounds %struct.bar, %struct.bar* %this1, i32 0, i32 0, !dbg !67
Eric Christopher27886c62011-12-16 23:42:45 +000056 store %struct.baz* %b2, %struct.baz** %1, align 8, !dbg !67
57 ret void, !dbg !68
58}
59
60define linkonce_odr void @_ZN3bazC1Ei(%struct.baz* %this, i32 %a) unnamed_addr uwtable ssp align 2 {
61entry:
62 %this.addr = alloca %struct.baz*, align 8
63 %a.addr = alloca i32, align 4
64 store %struct.baz* %this, %struct.baz** %this.addr, align 8
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000065 call void @llvm.dbg.declare(metadata %struct.baz** %this.addr, metadata !70, metadata !{!"0x102"}), !dbg !71
Eric Christopher27886c62011-12-16 23:42:45 +000066 store i32 %a, i32* %a.addr, align 4
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000067 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !72, metadata !{!"0x102"}), !dbg !73
David Blaikiea79ac142015-02-27 21:17:42 +000068 %this1 = load %struct.baz*, %struct.baz** %this.addr
69 %0 = load i32, i32* %a.addr, align 4, !dbg !74
Eric Christopher27886c62011-12-16 23:42:45 +000070 call void @_ZN3bazC2Ei(%struct.baz* %this1, i32 %0), !dbg !74
71 ret void, !dbg !74
72}
73
74define linkonce_odr void @_ZN3bazC2Ei(%struct.baz* %this, i32 %a) unnamed_addr nounwind uwtable ssp align 2 {
75entry:
76 %this.addr = alloca %struct.baz*, align 8
77 %a.addr = alloca i32, align 4
78 store %struct.baz* %this, %struct.baz** %this.addr, align 8
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000079 call void @llvm.dbg.declare(metadata %struct.baz** %this.addr, metadata !75, metadata !{!"0x102"}), !dbg !76
Eric Christopher27886c62011-12-16 23:42:45 +000080 store i32 %a, i32* %a.addr, align 4
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000081 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !77, metadata !{!"0x102"}), !dbg !78
David Blaikiea79ac142015-02-27 21:17:42 +000082 %this1 = load %struct.baz*, %struct.baz** %this.addr
David Blaikie79e6c742015-02-27 19:29:02 +000083 %h = getelementptr inbounds %struct.baz, %struct.baz* %this1, i32 0, i32 0, !dbg !79
David Blaikiea79ac142015-02-27 21:17:42 +000084 %0 = load i32, i32* %a.addr, align 4, !dbg !79
Eric Christopher27886c62011-12-16 23:42:45 +000085 store i32 %0, i32* %h, align 4, !dbg !79
86 ret void, !dbg !80
87}
88
89!llvm.dbg.cu = !{!0}
Manman Ren409558f2013-11-22 21:49:45 +000090!llvm.module.flags = !{!83}
Eric Christopher27886c62011-12-16 23:42:45 +000091
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000092!0 = !{!"0x11\004\00clang version 3.1 (trunk 146596)\000\00\000\00\000", !82, !1, !3, !27, !1, !1} ; [ DW_TAG_compile_unit ]
93!1 = !{}
94!3 = !{!5, !9}
95!5 = !{!"0x2\00bar\009\00128\0064\000\000\000", !82, null, null, !7, null, null, null} ; [ DW_TAG_class_type ] [bar] [line 9, size 128, align 64, offset 0] [def] [from ]
96!6 = !{!"0x29", !82} ; [ DW_TAG_file_type ]
97!7 = !{!8, !19, !21}
98!8 = !{!"0xd\00b\0011\0032\0032\000\000", !82, !5, !9} ; [ DW_TAG_member ]
99!9 = !{!"0x2\00baz\003\0032\0032\000\000\000", !82, null, null, !10, null, null, null} ; [ DW_TAG_class_type ] [baz] [line 3, size 32, align 32, offset 0] [def] [from ]
100!10 = !{!11, !13}
101!11 = !{!"0xd\00h\005\0032\0032\000\000", !82, !9, !12} ; [ DW_TAG_member ]
102!12 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ]
103!13 = !{!"0x2e\00baz\00baz\00\006\000\000\000\006\00256\000\000", !82, !9, !14, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ]
104!14 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !15, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
105!15 = !{null, !16, !12}
106!16 = !{!"0xf\00\000\0064\0064\000\0064", i32 0, null, !9} ; [ DW_TAG_pointer_type ]
107!19 = !{!"0xd\00b_ref\0012\0064\0064\0064\000", !82, !5, !20} ; [ DW_TAG_member ]
108!20 = !{!"0x10\00\000\000\000\000\000", null, null, !9} ; [ DW_TAG_reference_type ]
109!21 = !{!"0x2e\00bar\00bar\00\0013\000\000\000\006\00256\000\000", !82, !5, !22, null, null, null, i32 0, null} ; [ DW_TAG_subprogram ]
110!22 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !23, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
111!23 = !{null, !24, !12}
112!24 = !{!"0xf\00\000\0064\0064\000\0064", i32 0, null, !5} ; [ DW_TAG_pointer_type ]
113!27 = !{!29, !37, !40, !43, !46}
114!29 = !{!"0x2e\00main\00main\00\0017\000\001\000\006\00256\000\000", !82, !6, !30, null, i32 (i32, i8**)* @main, null, null, null} ; [ DW_TAG_subprogram ] [line 17] [def] [scope 0] [main]
115!30 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !31, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
116!31 = !{!12, !12, !32}
117!32 = !{!"0xf\00\000\0064\0064\000\000", null, null, !33} ; [ DW_TAG_pointer_type ]
118!33 = !{!"0xf\00\000\0064\0064\000\000", null, null, !34} ; [ DW_TAG_pointer_type ]
119!34 = !{!"0x24\00char\000\008\008\000\000\006", null, null} ; [ DW_TAG_base_type ]
120!35 = !{!36}
121!36 = !{!"0x24"} ; [ DW_TAG_base_type ]
122!37 = !{!"0x2e\00bar\00bar\00_ZN3barC1Ei\0013\000\001\000\006\00256\000\000", !82, null, !22, null, void (%struct.bar*, i32)* @_ZN3barC1Ei, null, !21, null} ; [ DW_TAG_subprogram ] [line 13] [def] [scope 0] [bar]
123!38 = !{!39}
124!39 = !{!"0x24"} ; [ DW_TAG_base_type ]
125!40 = !{!"0x2e\00bar\00bar\00_ZN3barC2Ei\0013\000\001\000\006\00256\000\000", !82, null, !22, null, void (%struct.bar*, i32)* @_ZN3barC2Ei, null, !21, null} ; [ DW_TAG_subprogram ] [line 13] [def] [scope 0] [bar]
126!41 = !{!42}
127!42 = !{!"0x24"} ; [ DW_TAG_base_type ]
128!43 = !{!"0x2e\00baz\00baz\00_ZN3bazC1Ei\006\000\001\000\006\00256\000\000", !82, null, !14, null, void (%struct.baz*, i32)* @_ZN3bazC1Ei, null, !13, null} ; [ DW_TAG_subprogram ] [line 6] [def] [scope 0] [baz]
129!44 = !{!45}
130!45 = !{!"0x24"} ; [ DW_TAG_base_type ]
131!46 = !{!"0x2e\00baz\00baz\00_ZN3bazC2Ei\006\000\001\000\006\00256\000\000", !82, null, !14, null, void (%struct.baz*, i32)* @_ZN3bazC2Ei, null, !13, null} ; [ DW_TAG_subprogram ] [line 6] [def] [scope 0] [baz]
132!49 = !{!"0x101\00argc\0016777232\000", !29, !6, !12} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000133!50 = !MDLocation(line: 16, column: 14, scope: !29)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000134!51 = !{!"0x101\00argv\0033554448\000", !29, !6, !32} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000135!52 = !MDLocation(line: 16, column: 27, scope: !29)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000136!53 = !{!"0x100\00myBar\0018\000", !54, !6, !5} ; [ DW_TAG_auto_variable ]
137!54 = !{!"0xb\0017\001\000", !82, !29} ; [ DW_TAG_lexical_block ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000138!55 = !MDLocation(line: 18, column: 9, scope: !54)
139!56 = !MDLocation(line: 18, column: 17, scope: !54)
140!57 = !MDLocation(line: 19, column: 5, scope: !54)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000141!58 = !{!"0x101\00this\0016777229\0064", !37, !6, !24} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000142!59 = !MDLocation(line: 13, column: 5, scope: !37)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000143!60 = !{!"0x101\00x\0033554445\000", !37, !6, !12} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000144!61 = !MDLocation(line: 13, column: 13, scope: !37)
145!62 = !MDLocation(line: 13, column: 34, scope: !37)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000146!63 = !{!"0x101\00this\0016777229\0064", !40, !6, !24} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000147!64 = !MDLocation(line: 13, column: 5, scope: !40)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000148!65 = !{!"0x101\00x\0033554445\000", !40, !6, !12} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000149!66 = !MDLocation(line: 13, column: 13, scope: !40)
150!67 = !MDLocation(line: 13, column: 33, scope: !40)
151!68 = !MDLocation(line: 13, column: 34, scope: !69)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000152!69 = !{!"0xb\0013\0033\001", !82, !40} ; [ DW_TAG_lexical_block ]
153!70 = !{!"0x101\00this\0016777222\0064", !43, !6, !16} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000154!71 = !MDLocation(line: 6, column: 5, scope: !43)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000155!72 = !{!"0x101\00a\0033554438\000", !43, !6, !12} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000156!73 = !MDLocation(line: 6, column: 13, scope: !43)
157!74 = !MDLocation(line: 6, column: 24, scope: !43)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000158!75 = !{!"0x101\00this\0016777222\0064", !46, !6, !16} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000159!76 = !MDLocation(line: 6, column: 5, scope: !46)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000160!77 = !{!"0x101\00a\0033554438\000", !46, !6, !12} ; [ DW_TAG_arg_variable ]
Duncan P. N. Exon Smith98854692015-01-14 22:27:36 +0000161!78 = !MDLocation(line: 6, column: 13, scope: !46)
162!79 = !MDLocation(line: 6, column: 23, scope: !46)
163!80 = !MDLocation(line: 6, column: 24, scope: !81)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +0000164!81 = !{!"0xb\006\0023\002", !82, !46} ; [ DW_TAG_lexical_block ]
165!82 = !{!"main.cpp", !"/Users/echristo/tmp/bad-struct-ref"}
166!83 = !{i32 1, !"Debug Info Version", i32 2}