2012-12-04 14:20:49 +08:00
|
|
|
; RUN: llc -mtriple=x86_64-apple-darwin -O0 -filetype=obj -o %t < %s
|
2013-01-26 05:44:53 +08:00
|
|
|
; RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck %s
|
2012-12-04 14:20:49 +08:00
|
|
|
; <rdar://problem/12566646>
|
|
|
|
|
|
|
|
%struct.foo = type { i32, [1 x i32] }
|
|
|
|
%struct.bar = type { i32, [0 x i32] }
|
|
|
|
|
|
|
|
define i32 @func() nounwind uwtable ssp {
|
|
|
|
entry:
|
|
|
|
%my_foo = alloca %struct.foo, align 4
|
|
|
|
%my_bar = alloca %struct.bar, align 4
|
|
|
|
call void @llvm.dbg.declare(metadata !{%struct.foo* %my_foo}, metadata !10), !dbg !19
|
|
|
|
call void @llvm.dbg.declare(metadata !{%struct.bar* %my_bar}, metadata !20), !dbg !28
|
|
|
|
%a = getelementptr inbounds %struct.foo* %my_foo, i32 0, i32 0, !dbg !29
|
|
|
|
store i32 3, i32* %a, align 4, !dbg !29
|
|
|
|
%a1 = getelementptr inbounds %struct.bar* %my_bar, i32 0, i32 0, !dbg !30
|
|
|
|
store i32 5, i32* %a1, align 4, !dbg !30
|
|
|
|
%a2 = getelementptr inbounds %struct.foo* %my_foo, i32 0, i32 0, !dbg !31
|
|
|
|
%0 = load i32* %a2, align 4, !dbg !31
|
|
|
|
%a3 = getelementptr inbounds %struct.bar* %my_bar, i32 0, i32 0, !dbg !31
|
|
|
|
%1 = load i32* %a3, align 4, !dbg !31
|
|
|
|
%add = add nsw i32 %0, %1, !dbg !31
|
|
|
|
ret i32 %add, !dbg !31
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone
|
|
|
|
|
|
|
|
; An empty array should not have an AT_upper_bound attribute. But an array of 1
|
|
|
|
; should.
|
|
|
|
|
2013-10-30 06:49:29 +08:00
|
|
|
; int foo::b[1]:
|
|
|
|
; CHECK: DW_TAG_structure_type
|
|
|
|
; CHECK: DW_AT_name{{.*}}"foo"
|
|
|
|
; CHECK: DW_TAG_member
|
|
|
|
; CHECK: DW_TAG_member
|
|
|
|
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "b")
|
|
|
|
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]
|
|
|
|
|
DebugInfo: Lazily attach definition attributes to definitions.
This is a precursor to fixing inlined debug info where the concrete,
out-of-line definition may preceed any inlined usage. To cope with this,
the attributes that may appear on the concrete definition or the
abstract definition are delayed until the end of the module. Then, if an
abstract definition was created, it is referenced (and no other
attributes are added to the out-of-line definition), otherwise the
attributes are added directly to the out-of-line definition.
In a couple of cases this causes not just reordering of attributes, but
reordering of types. When the creation of the attribute is delayed, if
that creation would create a type (such as for a DW_AT_type attribute)
then other top level DIEs may've been constructed during the delay,
causing the referenced type to be created and added after those
intervening DIEs. In the extreme case, in cross-cu-inlining.ll, this
actually causes the DW_TAG_basic_type for "int" to move from one CU to
another.
llvm-svn: 209674
2014-05-28 02:37:43 +08:00
|
|
|
; CHECK: DW_TAG_base_type
|
|
|
|
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "int")
|
|
|
|
; CHECK-NEXT: DW_AT_encoding [DW_FORM_data1] (0x05)
|
|
|
|
; CHECK-NEXT: DW_AT_byte_size [DW_FORM_data1] (0x04)
|
|
|
|
|
2012-12-04 14:20:49 +08:00
|
|
|
; int[1]:
|
2013-10-30 06:49:29 +08:00
|
|
|
; CHECK: DW_TAG_array_type [{{.*}}] *
|
2013-09-05 06:21:24 +08:00
|
|
|
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]
|
2013-10-30 06:49:29 +08:00
|
|
|
; CHECK: DW_TAG_subrange_type [{{.*}}]
|
2013-09-05 06:21:24 +08:00
|
|
|
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]
|
2013-01-05 05:51:53 +08:00
|
|
|
; CHECK-NEXT: DW_AT_upper_bound [DW_FORM_data1] (0x00)
|
2012-12-04 14:20:49 +08:00
|
|
|
|
2013-10-30 06:49:29 +08:00
|
|
|
; int bar::b[0]:
|
|
|
|
; CHECK: DW_TAG_structure_type
|
|
|
|
; CHECK: DW_AT_name{{.*}}"bar"
|
|
|
|
; CHECK: DW_TAG_member
|
|
|
|
; CHECK: DW_TAG_member
|
2013-09-05 06:21:24 +08:00
|
|
|
; CHECK-NEXT: DW_AT_name [DW_FORM_strp] ( .debug_str[{{.*}}] = "b")
|
|
|
|
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]
|
2012-12-04 14:20:49 +08:00
|
|
|
|
|
|
|
; int[0]:
|
2013-10-30 06:49:29 +08:00
|
|
|
; CHECK: DW_TAG_array_type [{{.*}}] *
|
2013-09-05 06:21:24 +08:00
|
|
|
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]
|
|
|
|
; CHECK: DW_TAG_subrange_type [11]
|
|
|
|
; CHECK-NEXT: DW_AT_type [DW_FORM_ref4]
|
2012-12-05 05:34:03 +08:00
|
|
|
; CHECK-NOT: DW_AT_upper_bound
|
2012-12-04 14:20:49 +08:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2013-11-23 05:49:45 +08:00
|
|
|
!llvm.module.flags = !{!33}
|
2012-12-04 14:20:49 +08:00
|
|
|
|
2013-04-22 14:12:31 +08:00
|
|
|
!0 = metadata !{i32 786449, metadata !32, i32 12, metadata !"clang version 3.3 (trunk 169136)", i1 false, metadata !"", i32 0, metadata !1, metadata !1, metadata !3, metadata !1, metadata !1, metadata !""} ; [ DW_TAG_compile_unit ] [/Volumes/Sandbox/llvm/test.c] [DW_LANG_C99]
|
2014-02-04 09:23:52 +08:00
|
|
|
!1 = metadata !{}
|
2013-02-02 13:56:24 +08:00
|
|
|
!3 = metadata !{metadata !5}
|
2013-03-28 10:44:59 +08:00
|
|
|
!5 = metadata !{i32 786478, metadata !6, metadata !6, metadata !"func", metadata !"func", metadata !"", i32 11, metadata !7, i1 false, i1 true, i32 0, i32 0, null, i32 0, i1 false, i32 ()* @func, null, null, metadata !1, i32 11} ; [ DW_TAG_subprogram ] [line 11] [def] [func]
|
|
|
|
!6 = metadata !{i32 786473, metadata !32} ; [ DW_TAG_file_type ]
|
2013-09-08 11:11:54 +08:00
|
|
|
!7 = metadata !{i32 786453, i32 0, null, i32 0, i32 0, i64 0, i64 0, i64 0, i32 0, null, metadata !8, i32 0, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2012-12-04 14:20:49 +08:00
|
|
|
!8 = metadata !{metadata !9}
|
2013-03-28 10:44:59 +08:00
|
|
|
!9 = metadata !{i32 786468, null, null, metadata !"int", i32 0, i64 32, i64 32, i64 0, i32 0, i32 5} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
|
2012-12-04 14:20:49 +08:00
|
|
|
!10 = metadata !{i32 786688, metadata !11, metadata !"my_foo", metadata !6, i32 12, metadata !12, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [my_foo] [line 12]
|
2013-03-28 10:44:59 +08:00
|
|
|
!11 = metadata !{i32 786443, metadata !6, metadata !5, i32 11, i32 0, i32 0} ; [ DW_TAG_lexical_block ] [/Volumes/Sandbox/llvm/test.c]
|
2013-09-07 02:13:59 +08:00
|
|
|
!12 = metadata !{i32 786451, metadata !32, null, metadata !"foo", i32 1, i64 64, i64 32, i32 0, i32 0, null, metadata !13, i32 0, null, i32 0, null} ; [ DW_TAG_structure_type ] [foo] [line 1, size 64, align 32, offset 0] [def] [from ]
|
2012-12-04 14:20:49 +08:00
|
|
|
!13 = metadata !{metadata !14, metadata !15}
|
2013-03-28 10:44:59 +08:00
|
|
|
!14 = metadata !{i32 786445, metadata !32, metadata !12, metadata !"a", i32 2, i64 32, i64 32, i64 0, i32 0, metadata !9} ; [ DW_TAG_member ] [a] [line 2, size 32, align 32, offset 0] [from int]
|
|
|
|
!15 = metadata !{i32 786445, metadata !32, metadata !12, metadata !"b", i32 3, i64 32, i64 32, i64 32, i32 0, metadata !16} ; [ DW_TAG_member ] [b] [line 3, size 32, align 32, offset 32] [from ]
|
2013-09-07 02:13:59 +08:00
|
|
|
!16 = metadata !{i32 786433, null, null, metadata !"", i32 0, i64 32, i64 32, i32 0, i32 0, metadata !9, metadata !17, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 32, align 32, offset 0] [from int]
|
2012-12-04 14:20:49 +08:00
|
|
|
!17 = metadata !{metadata !18}
|
2012-12-05 05:34:03 +08:00
|
|
|
!18 = metadata !{i32 786465, i64 0, i64 1} ; [ DW_TAG_subrange_type ] [0, 1]
|
2012-12-04 14:20:49 +08:00
|
|
|
!19 = metadata !{i32 12, i32 0, metadata !11, null}
|
|
|
|
!20 = metadata !{i32 786688, metadata !11, metadata !"my_bar", metadata !6, i32 13, metadata !21, i32 0, i32 0} ; [ DW_TAG_auto_variable ] [my_bar] [line 13]
|
2013-09-07 02:13:59 +08:00
|
|
|
!21 = metadata !{i32 786451, metadata !32, null, metadata !"bar", i32 6, i64 32, i64 32, i32 0, i32 0, null, metadata !22, i32 0, null, i32 0, null} ; [ DW_TAG_structure_type ] [bar] [line 6, size 32, align 32, offset 0] [def] [from ]
|
2012-12-04 14:20:49 +08:00
|
|
|
!22 = metadata !{metadata !23, metadata !24}
|
2013-03-28 10:44:59 +08:00
|
|
|
!23 = metadata !{i32 786445, metadata !32, metadata !21, metadata !"a", i32 7, i64 32, i64 32, i64 0, i32 0, metadata !9} ; [ DW_TAG_member ] [a] [line 7, size 32, align 32, offset 0] [from int]
|
|
|
|
!24 = metadata !{i32 786445, metadata !32, metadata !21, metadata !"b", i32 8, i64 0, i64 32, i64 32, i32 0, metadata !25} ; [ DW_TAG_member ] [b] [line 8, size 0, align 32, offset 32] [from ]
|
2013-09-07 02:13:59 +08:00
|
|
|
!25 = metadata !{i32 786433, null, null, metadata !"", i32 0, i64 0, i64 32, i32 0, i32 0, metadata !9, metadata !26, i32 0, null, null, null} ; [ DW_TAG_array_type ] [line 0, size 0, align 32, offset 0] [from int]
|
2012-12-04 14:20:49 +08:00
|
|
|
!26 = metadata !{metadata !27}
|
2012-12-05 05:34:03 +08:00
|
|
|
!27 = metadata !{i32 786465, i64 0, i64 0} ; [ DW_TAG_subrange_type ] [0, 0]
|
2012-12-04 14:20:49 +08:00
|
|
|
!28 = metadata !{i32 13, i32 0, metadata !11, null}
|
|
|
|
!29 = metadata !{i32 15, i32 0, metadata !11, null}
|
|
|
|
!30 = metadata !{i32 16, i32 0, metadata !11, null}
|
|
|
|
!31 = metadata !{i32 17, i32 0, metadata !11, null}
|
2013-03-18 05:13:55 +08:00
|
|
|
!32 = metadata !{metadata !"test.c", metadata !"/Volumes/Sandbox/llvm"}
|
2013-11-23 05:49:45 +08:00
|
|
|
!33 = metadata !{i32 1, metadata !"Debug Info Version", i32 1}
|