2014-08-02 06:11:58 +08:00
|
|
|
; RUN: llc -O0 %s -filetype=obj -o %t.o
|
2014-08-02 07:01:32 +08:00
|
|
|
; RUN: llvm-dwarfdump -debug-dump=loc %t.o | FileCheck %s
|
2014-08-02 06:11:58 +08:00
|
|
|
;
|
|
|
|
; rdar://problem/15928306
|
|
|
|
;
|
|
|
|
; Test that we can emit debug info for aggregate values that are split
|
|
|
|
; up across multiple registers by SROA.
|
|
|
|
;
|
|
|
|
; // Compile with -O1.
|
|
|
|
; typedef struct { long int a; int b;} S;
|
|
|
|
;
|
|
|
|
; int foo(S s) {
|
|
|
|
; return s.b;
|
|
|
|
; }
|
|
|
|
;
|
|
|
|
;
|
2014-08-02 07:01:32 +08:00
|
|
|
; CHECK: .debug_loc contents:
|
2014-08-02 06:11:58 +08:00
|
|
|
;
|
|
|
|
|
|
|
|
; 0x0000000000000000 - 0x0000000000000006: rdi, piece 0x00000008, rsi, piece 0x00000004
|
2014-08-02 07:01:32 +08:00
|
|
|
; CHECK: Beginning address offset: 0x0000000000000000
|
|
|
|
; CHECK: Ending address offset: [[LTMP3:.*]]
|
|
|
|
; CHECK: Location description: 55 93 08 54 93 04
|
2014-08-02 06:11:58 +08:00
|
|
|
; 0x0000000000000006 - 0x0000000000000008: rbp-8, piece 0x00000008, rax, piece 0x00000004 )
|
2014-08-02 07:01:32 +08:00
|
|
|
; CHECK: Beginning address offset: [[LTMP3]]
|
|
|
|
; CHECK: Ending address offset: [[END:.*]]
|
|
|
|
; CHECK: Location description: 76 78 93 08 54 93 04
|
2014-08-02 06:11:58 +08:00
|
|
|
|
2014-08-02 07:01:30 +08:00
|
|
|
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
|
|
|
target triple = "x86_64-apple-macosx10.9.0"
|
|
|
|
|
2014-08-02 06:11:58 +08:00
|
|
|
; Function Attrs: nounwind ssp uwtable
|
|
|
|
define i32 @foo(i64 %s.coerce0, i32 %s.coerce1) #0 {
|
|
|
|
entry:
|
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.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
|
|
|
call void @llvm.dbg.value(metadata !{i64 %s.coerce0}, i64 0, metadata !20, metadata !24), !dbg !21
|
|
|
|
call void @llvm.dbg.value(metadata !{i32 %s.coerce1}, i64 0, metadata !22, metadata !27), !dbg !21
|
2014-08-02 06:11:58 +08:00
|
|
|
ret i32 %s.coerce1, !dbg !23
|
|
|
|
}
|
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
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.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
|
|
|
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
|
2014-08-02 06:11:58 +08:00
|
|
|
|
|
|
|
; Function Attrs: nounwind readnone
|
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.
llvm-svn: 218787
2014-10-02 02:55:02 +08:00
|
|
|
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
|
2014-08-02 06:11:58 +08:00
|
|
|
|
|
|
|
attributes #0 = { nounwind ssp uwtable "no-frame-pointer-elim"="true" "no-frame-pointer-elim-non-leaf" }
|
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
|
|
!llvm.module.flags = !{!17, !18}
|
|
|
|
!llvm.ident = !{!19}
|
|
|
|
|
2014-10-04 04:01:09 +08:00
|
|
|
!0 = metadata !{metadata !"0x11\0012\00clang version 3.5 \001\00\000\00\001", metadata !1, metadata !2, metadata !2, metadata !3, metadata !2, metadata !2} ; [ DW_TAG_compile_unit ]
|
2014-08-02 06:11:58 +08:00
|
|
|
!1 = metadata !{metadata !"pieces.c", metadata !""}
|
|
|
|
!2 = metadata !{}
|
|
|
|
!3 = metadata !{metadata !4}
|
2014-10-04 04:01:09 +08:00
|
|
|
!4 = metadata !{metadata !"0x2e\00foo\00foo\00\003\000\001\000\006\00256\001\003", metadata !1, metadata !5, metadata !6, null, i32 (i64, i32)* @foo, null, null, metadata !15} ; [ DW_TAG_subprogram ] [line 3] [def] [foo]
|
|
|
|
!5 = metadata !{metadata !"0x29", metadata !1} ; [ DW_TAG_file_type ] [/pieces.c]
|
|
|
|
!6 = metadata !{metadata !"0x15\00\000\000\000\000\000\000", i32 0, null, null, metadata !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
2014-08-02 06:11:58 +08:00
|
|
|
!7 = metadata !{metadata !8, metadata !9}
|
2014-10-04 04:01:09 +08:00
|
|
|
!8 = metadata !{metadata !"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]
|
|
|
|
!9 = metadata !{metadata !"0x16\00S\001\000\000\000\000", metadata !1, null, metadata !10} ; [ DW_TAG_typedef ] [S] [line 1, size 0, align 0, offset 0] [from ]
|
|
|
|
!10 = metadata !{metadata !"0x13\00\001\00128\0064\000\000\000", metadata !1, null, null, metadata !11, null, null, null} ; [ DW_TAG_structure_type ] [line 1, size 128, align 64, offset 0] [def] [from ]
|
2014-08-02 06:11:58 +08:00
|
|
|
!11 = metadata !{metadata !12, metadata !14}
|
2014-10-04 04:01:09 +08:00
|
|
|
!12 = metadata !{metadata !"0xd\00a\001\0064\0064\000\000", metadata !1, metadata !10, metadata !13} ; [ DW_TAG_member ] [a] [line 1, size 64, align 64, offset 0] [from long int]
|
|
|
|
!13 = metadata !{metadata !"0x24\00long int\000\0064\0064\000\000\005", null, null} ; [ DW_TAG_base_type ] [long int] [line 0, size 64, align 64, offset 0, enc DW_ATE_signed]
|
|
|
|
!14 = metadata !{metadata !"0xd\00b\001\0032\0032\0064\000", metadata !1, metadata !10, metadata !8} ; [ DW_TAG_member ] [b] [line 1, size 32, align 32, offset 64] [from int]
|
2014-08-02 06:11:58 +08:00
|
|
|
!15 = metadata !{metadata !16}
|
2014-10-04 04:01:09 +08:00
|
|
|
!16 = metadata !{metadata !"0x101\00s\0016777219\000", metadata !4, metadata !5, metadata !9} ; [ DW_TAG_arg_variable ] [s] [line 3]
|
2014-08-02 06:11:58 +08:00
|
|
|
!17 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
|
2014-10-04 04:01:09 +08:00
|
|
|
!18 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
|
2014-08-02 06:11:58 +08:00
|
|
|
!19 = metadata !{metadata !"clang version 3.5 "}
|
2014-10-04 04:01:09 +08:00
|
|
|
!20 = metadata !{metadata !"0x101\00s\0016777219\000", metadata !4, metadata !5, metadata !9} ; [ DW_TAG_arg_variable ] [s] [line 3]
|
2014-08-02 06:11:58 +08:00
|
|
|
!21 = metadata !{i32 3, i32 0, metadata !4, null}
|
2014-10-04 04:01:09 +08:00
|
|
|
!22 = metadata !{metadata !"0x101\00s\0016777219\000", metadata !4, metadata !5, metadata !9} ; [ DW_TAG_arg_variable ] [s] [line 3]
|
2014-08-02 06:11:58 +08:00
|
|
|
!23 = metadata !{i32 4, i32 0, metadata !4, null}
|
2014-10-04 04:01:09 +08:00
|
|
|
!24 = metadata !{metadata !"0x102\00147\000\008"} ; [ DW_TAG_expression ] [DW_OP_piece 0 8] [piece, size 8, offset 0]
|
2014-08-02 06:11:58 +08:00
|
|
|
!25 = metadata !{}
|
2014-10-04 04:01:09 +08:00
|
|
|
!27 = metadata !{metadata !"0x102\00147\008\004"} ; [ DW_TAG_expression ] [DW_OP_piece 8 4] [piece, size 4, offset 8]
|