2014-01-30 01:39:17 +00:00
|
|
|
; RUN: %llc_dwarf -O0 < %s | FileCheck %s -check-prefix ARGUMENT
|
|
|
|
; RUN: %llc_dwarf -O0 < %s | FileCheck %s -check-prefix VARIABLE
|
2012-07-06 08:45:08 +00:00
|
|
|
; PR 13202
|
|
|
|
|
|
|
|
define i32 @main() uwtable {
|
|
|
|
entry:
|
2014-10-03 20:01:09 +00:00
|
|
|
tail call void @llvm.dbg.value(metadata !1, i64 0, metadata !18, metadata !{metadata !"0x102"}), !dbg !21
|
|
|
|
tail call void @llvm.dbg.value(metadata !1, i64 0, metadata !22, metadata !{metadata !"0x102"}), !dbg !23
|
2012-07-06 08:45:08 +00:00
|
|
|
tail call void @smth(i32 0), !dbg !24
|
|
|
|
tail call void @smth(i32 0), !dbg !25
|
|
|
|
ret i32 0, !dbg !19
|
|
|
|
}
|
|
|
|
|
|
|
|
declare void @smth(i32)
|
|
|
|
|
Move the complex address expression out of DIVariable and into an extra
argument of the llvm.dbg.declare/llvm.dbg.value intrinsics.
Previously, DIVariable was a variable-length field that has an optional
reference to a Metadata array consisting of a variable number of
complex address expressions. In the case of OpPiece expressions this is
wasting a lot of storage in IR, because when an aggregate type is, e.g.,
SROA'd into all of its n individual members, the IR will contain n copies
of the DIVariable, all alike, only differing in the complex address
reference at the end.
By making the complex address into an extra argument of the
dbg.value/dbg.declare intrinsics, all of the pieces can reference the
same variable and the complex address expressions can be uniqued across
the CU, too.
Down the road, this will allow us to move other flags, such as
"indirection" out of the DIVariable, too.
The new intrinsics look like this:
declare void @llvm.dbg.declare(metadata %storage, metadata %var, metadata %expr)
declare void @llvm.dbg.value(metadata %storage, i64 %offset, metadata %var, metadata %expr)
This patch adds a new LLVM-local tag to DIExpressions, so we can detect
and pretty-print DIExpression metadata nodes.
What this patch doesn't do:
This patch does not touch the "Indirect" field in DIVariable; but moving
that into the expression would be a natural next step.
http://reviews.llvm.org/D4919
rdar://problem/17994491
Thanks to dblaikie and dexonsmith for reviewing this patch!
Note: I accidentally committed a bogus older version of this patch previously.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218787 91177308-0d34-0410-b5e6-96231b3b80d8
2014-10-01 18:55:02 +00:00
|
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
|
2012-07-06 08:45:08 +00:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2013-11-22 21:49:45 +00:00
|
|
|
!llvm.module.flags = !{!27}
|
2012-07-06 08:45:08 +00:00
|
|
|
|
2014-10-03 20:01:09 +00:00
|
|
|
!0 = metadata !{metadata !"0x11\004\00clang version 3.2 (trunk 159419)\001\00\000\00\000", metadata !26, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ]
|
2013-02-02 05:56:24 +00:00
|
|
|
!1 = metadata !{i32 0}
|
2014-02-04 01:23:52 +00:00
|
|
|
!2 = metadata !{}
|
2013-02-02 05:56:24 +00:00
|
|
|
!3 = metadata !{metadata !5, metadata !10}
|
2014-10-03 20:01:09 +00:00
|
|
|
!5 = metadata !{metadata !"0x2e\00main\00main\00\0010\000\001\000\006\00256\001\0010", metadata !26, metadata !6, metadata !7, null, i32 ()* @main, null, null, metadata !2} ; [ DW_TAG_subprogram ]
|
|
|
|
!6 = metadata !{metadata !"0x29", metadata !26} ; [ DW_TAG_file_type ]
|
|
|
|
!7 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", null, null, null, metadata !8, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2012-07-06 08:45:08 +00:00
|
|
|
!8 = metadata !{metadata !9}
|
2014-10-03 20:01:09 +00:00
|
|
|
!9 = metadata !{metadata !"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ]
|
|
|
|
!10 = metadata !{metadata !"0x2e\00f\00f\00_ZL1fi\003\001\001\000\006\00256\001\003", metadata !26, metadata !6, metadata !11, null, null, null, null, metadata !13} ; [ DW_TAG_subprogram ]
|
|
|
|
!11 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", null, null, null, metadata !12, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2012-07-06 08:45:08 +00:00
|
|
|
!12 = metadata !{metadata !9, metadata !9}
|
2014-05-12 18:23:35 +00:00
|
|
|
!13 = metadata !{metadata !15, metadata !16}
|
2014-10-03 20:01:09 +00:00
|
|
|
!15 = metadata !{metadata !"0x101\00argument\0016777219\000", metadata !10, metadata !6, metadata !9} ; [ DW_TAG_arg_variable ]
|
2012-07-06 08:45:08 +00:00
|
|
|
|
|
|
|
; Two DW_TAG_formal_parameter: one abstract and one inlined.
|
|
|
|
; ARGUMENT: {{.*Abbrev.*DW_TAG_formal_parameter}}
|
|
|
|
; ARGUMENT: {{.*Abbrev.*DW_TAG_formal_parameter}}
|
|
|
|
; ARGUMENT-NOT: {{.*Abbrev.*DW_TAG_formal_parameter}}
|
|
|
|
|
2014-10-03 20:01:09 +00:00
|
|
|
!16 = metadata !{metadata !"0x100\00local\004\000", metadata !10, metadata !6, metadata !9} ; [ DW_TAG_auto_variable ]
|
2012-07-06 08:45:08 +00:00
|
|
|
|
|
|
|
; Two DW_TAG_variable: one abstract and one inlined.
|
|
|
|
; VARIABLE: {{.*Abbrev.*DW_TAG_variable}}
|
|
|
|
; VARIABLE: {{.*Abbrev.*DW_TAG_variable}}
|
|
|
|
; VARIABLE-NOT: {{.*Abbrev.*DW_TAG_variable}}
|
|
|
|
|
2014-10-03 20:01:09 +00:00
|
|
|
!18 = metadata !{metadata !"0x101\00argument\0016777219\000", metadata !10, metadata !6, metadata !9, metadata !19} ; [ DW_TAG_arg_variable ]
|
2013-01-26 21:55:23 +00:00
|
|
|
!19 = metadata !{i32 11, i32 10, metadata !5, null}
|
2012-07-06 08:45:08 +00:00
|
|
|
!21 = metadata !{i32 3, i32 25, metadata !10, metadata !19}
|
2014-10-03 20:01:09 +00:00
|
|
|
!22 = metadata !{metadata !"0x100\00local\004\000", metadata !10, metadata !6, metadata !9, metadata !19} ; [ DW_TAG_auto_variable ]
|
2013-01-26 21:55:23 +00:00
|
|
|
!23 = metadata !{i32 4, i32 16, metadata !10, metadata !19}
|
|
|
|
!24 = metadata !{i32 5, i32 3, metadata !10, metadata !19}
|
|
|
|
!25 = metadata !{i32 6, i32 3, metadata !10, metadata !19}
|
2013-03-20 01:55:11 +00:00
|
|
|
!26 = metadata !{metadata !"inline-bug.cc", metadata !"/tmp/dbginfo/pr13202"}
|
2014-10-03 20:01:09 +00:00
|
|
|
!27 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
|