2014-03-08 00:58:20 +00:00
|
|
|
; REQUIRES: object-emission
|
|
|
|
|
|
|
|
; RUN: llc -mtriple=x86_64-linux -O0 -filetype=obj < %s \
|
2014-08-29 09:00:26 +00:00
|
|
|
; RUN: | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-V4 %s
|
|
|
|
; RUN: llc -mtriple=x86_64-linux -dwarf-version=3 -O0 -filetype=obj < %s \
|
|
|
|
; RUN: | llvm-dwarfdump -debug-dump=info - | FileCheck --check-prefix=CHECK --check-prefix=CHECK-V3 %s
|
|
|
|
|
|
|
|
; Check that we emit DW_TAG_lexical_block and that it has the right encoding
|
|
|
|
; depending on the dwarf version.
|
2014-03-08 00:58:20 +00:00
|
|
|
|
|
|
|
; CHECK: DW_TAG_lexical_block
|
2014-08-29 15:32:15 +00:00
|
|
|
; CHECK-NOT: DW_TAG
|
2014-08-29 09:00:26 +00:00
|
|
|
; CHECK: DW_AT_low_pc [DW_FORM_addr]
|
2014-08-29 15:32:15 +00:00
|
|
|
; CHECK-NOT: DW_TAG
|
2014-08-29 09:00:26 +00:00
|
|
|
; CHECK-V4: DW_AT_high_pc [DW_FORM_data4]
|
|
|
|
; CHECK-V3: DW_AT_high_pc [DW_FORM_addr]
|
2014-03-08 00:58:20 +00:00
|
|
|
|
|
|
|
; Test case produced from:
|
|
|
|
; void b() {
|
|
|
|
; if (int i = 3)
|
|
|
|
; return;
|
|
|
|
; }
|
|
|
|
|
|
|
|
; Function Attrs: nounwind uwtable
|
|
|
|
define void @_Z1bv() #0 {
|
|
|
|
entry:
|
|
|
|
%i = alloca i32, align 4
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:07:53 +00:00
|
|
|
call void @llvm.dbg.declare(metadata i32* %i, metadata !11, metadata !{!"0x102"}), !dbg !14
|
2014-03-08 00:58:20 +00:00
|
|
|
store i32 3, i32* %i, align 4, !dbg !14
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32* %i, align 4, !dbg !14
|
2014-03-08 00:58:20 +00:00
|
|
|
%tobool = icmp ne i32 %0, 0, !dbg !14
|
|
|
|
br i1 %tobool, label %if.then, label %if.end, !dbg !14
|
|
|
|
|
|
|
|
if.then: ; preds = %entry
|
|
|
|
br label %if.end, !dbg !15
|
|
|
|
|
|
|
|
if.end: ; preds = %if.then, %entry
|
|
|
|
ret void, !dbg !16
|
|
|
|
}
|
|
|
|
|
|
|
|
; 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.
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.declare(metadata, metadata, metadata) #1
|
2014-03-08 00:58:20 +00:00
|
|
|
|
|
|
|
attributes #0 = { nounwind 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" }
|
|
|
|
attributes #1 = { nounwind readnone }
|
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
|
|
!llvm.module.flags = !{!8, !9}
|
|
|
|
!llvm.ident = !{!10}
|
|
|
|
|
IR: Make metadata typeless in assembly
Now that `Metadata` is typeless, reflect that in the assembly. These
are the matching assembly changes for the metadata/value split in
r223802.
- Only use the `metadata` type when referencing metadata from a call
intrinsic -- i.e., only when it's used as a `Value`.
- Stop pretending that `ValueAsMetadata` is wrapped in an `MDNode`
when referencing it from call intrinsics.
So, assembly like this:
define @foo(i32 %v) {
call void @llvm.foo(metadata !{i32 %v}, metadata !0)
call void @llvm.foo(metadata !{i32 7}, metadata !0)
call void @llvm.foo(metadata !1, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{metadata !3}, metadata !0)
ret void, !bar !2
}
!0 = metadata !{metadata !2}
!1 = metadata !{i32* @global}
!2 = metadata !{metadata !3}
!3 = metadata !{}
turns into this:
define @foo(i32 %v) {
call void @llvm.foo(metadata i32 %v, metadata !0)
call void @llvm.foo(metadata i32 7, metadata !0)
call void @llvm.foo(metadata i32* @global, metadata !0)
call void @llvm.foo(metadata !3, metadata !0)
call void @llvm.foo(metadata !{!3}, metadata !0)
ret void, !bar !2
}
!0 = !{!2}
!1 = !{i32* @global}
!2 = !{!3}
!3 = !{}
I wrote an upgrade script that handled almost all of the tests in llvm
and many of the tests in cfe (even handling many `CHECK` lines). I've
attached it (or will attach it in a moment if you're speedy) to PR21532
to help everyone update their out-of-tree testcases.
This is part of PR21532.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@224257 91177308-0d34-0410-b5e6-96231b3b80d8
2014-12-15 19:07:53 +00:00
|
|
|
!0 = !{!"0x11\004\00clang version 3.5.0 \000\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/lexical_block.cpp] [DW_LANG_C_plus_plus]
|
|
|
|
!1 = !{!"lexical_block.cpp", !"/tmp/dbginfo"}
|
|
|
|
!2 = !{}
|
|
|
|
!3 = !{!4}
|
|
|
|
!4 = !{!"0x2e\00b\00b\00_Z1bv\001\000\001\000\006\00256\000\001", !1, !5, !6, null, void ()* @_Z1bv, null, null, !2} ; [ DW_TAG_subprogram ] [line 1] [def] [b]
|
|
|
|
!5 = !{!"0x29", !1} ; [ DW_TAG_file_type ] [/tmp/dbginfo/lexical_block.cpp]
|
|
|
|
!6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
|
|
|
|
!7 = !{null}
|
|
|
|
!8 = !{i32 2, !"Dwarf Version", i32 4}
|
|
|
|
!9 = !{i32 1, !"Debug Info Version", i32 2}
|
|
|
|
!10 = !{!"clang version 3.5.0 "}
|
|
|
|
!11 = !{!"0x100\00i\002\000", !12, !5, !13} ; [ DW_TAG_auto_variable ] [i] [line 2]
|
|
|
|
!12 = !{!"0xb\002\000\000", !1, !4} ; [ DW_TAG_lexical_block ] [/tmp/dbginfo/lexical_block.cpp]
|
|
|
|
!13 = !{!"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]
|
2015-01-14 22:27:36 +00:00
|
|
|
!14 = !MDLocation(line: 2, scope: !12)
|
|
|
|
!15 = !MDLocation(line: 3, scope: !12)
|
|
|
|
!16 = !MDLocation(line: 4, scope: !4)
|