2014-03-26 23:10:28 +00:00
|
|
|
; RUN: llc -mtriple=x86_64-apple-darwin -filetype=obj %s -o %t
|
2013-01-25 21:44:53 +00:00
|
|
|
; RUN: llvm-dwarfdump -debug-dump=line %t | FileCheck %s
|
2012-04-03 17:55:42 +00:00
|
|
|
|
2012-04-05 20:39:05 +00:00
|
|
|
; Check that the line table starts at 7, not 4, but that the first
|
|
|
|
; statement isn't until line 8.
|
2012-04-03 17:55:42 +00:00
|
|
|
|
2014-02-14 19:27:53 +00:00
|
|
|
; CHECK-NOT: 0x0000000000000000 7 0 1 0 0 is_stmt
|
2012-04-05 20:39:05 +00:00
|
|
|
; CHECK: 0x0000000000000000 7 0 1 0
|
2014-02-14 19:27:53 +00:00
|
|
|
; CHECK: 0x0000000000000004 8 18 1 0 0 is_stmt prologue_end
|
2012-04-03 17:55:42 +00:00
|
|
|
|
|
|
|
define i32 @callee(i32 %x) nounwind uwtable ssp {
|
|
|
|
entry:
|
|
|
|
%x.addr = alloca i32, align 4
|
|
|
|
%y = alloca i32, align 4
|
|
|
|
store i32 %x, i32* %x.addr, align 4
|
2015-03-03 17:24:31 +00:00
|
|
|
call void @llvm.dbg.declare(metadata i32* %x.addr, metadata !12, metadata !MDExpression()), !dbg !13
|
|
|
|
call void @llvm.dbg.declare(metadata i32* %y, metadata !14, metadata !MDExpression()), !dbg !16
|
2015-02-27 21:17:42 +00:00
|
|
|
%0 = load i32, i32* %x.addr, align 4, !dbg !17
|
|
|
|
%1 = load i32, i32* %x.addr, align 4, !dbg !17
|
2012-04-03 17:55:42 +00:00
|
|
|
%mul = mul nsw i32 %0, %1, !dbg !17
|
|
|
|
store i32 %mul, i32* %y, align 4, !dbg !17
|
2015-02-27 21:17:42 +00:00
|
|
|
%2 = load i32, i32* %y, align 4, !dbg !18
|
2012-04-03 17:55:42 +00:00
|
|
|
%sub = sub nsw i32 %2, 2, !dbg !18
|
|
|
|
ret i32 %sub, !dbg !18
|
|
|
|
}
|
|
|
|
|
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) nounwind readnone
|
2012-04-03 17:55:42 +00:00
|
|
|
|
|
|
|
!llvm.dbg.cu = !{!0}
|
2013-11-22 21:49:45 +00:00
|
|
|
!llvm.module.flags = !{!20}
|
2012-04-03 17:55:42 +00:00
|
|
|
|
2015-03-03 17:24:31 +00:00
|
|
|
!0 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.1 (trunk 153921) (llvm/trunk 153916)", isOptimized: false, emissionKind: 0, file: !19, enums: !1, retainedTypes: !1, subprograms: !3, globals: !1, imports: !1)
|
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
|
|
|
!1 = !{}
|
|
|
|
!3 = !{!5}
|
2015-03-03 17:24:31 +00:00
|
|
|
!5 = !MDSubprogram(name: "callee", line: 4, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, scopeLine: 7, file: !19, scope: !6, type: !7, function: i32 (i32)* @callee)
|
|
|
|
!6 = !MDFile(filename: "ending-run.c", directory: "/Users/echristo/tmp")
|
|
|
|
!7 = !MDSubroutineType(types: !8)
|
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
|
|
|
!8 = !{!9, !9}
|
2015-03-03 17:24:31 +00:00
|
|
|
!9 = !MDBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
|
|
|
|
!12 = !MDLocalVariable(tag: DW_TAG_arg_variable, name: "x", line: 5, arg: 1, scope: !5, file: !6, type: !9)
|
2015-01-14 22:27:36 +00:00
|
|
|
!13 = !MDLocation(line: 5, column: 5, scope: !5)
|
2015-03-03 17:24:31 +00:00
|
|
|
!14 = !MDLocalVariable(tag: DW_TAG_auto_variable, name: "y", line: 8, scope: !15, file: !6, type: !9)
|
|
|
|
!15 = distinct !MDLexicalBlock(line: 7, column: 1, file: !19, scope: !5)
|
2015-01-14 22:27:36 +00:00
|
|
|
!16 = !MDLocation(line: 8, column: 9, scope: !15)
|
|
|
|
!17 = !MDLocation(line: 8, column: 18, scope: !15)
|
|
|
|
!18 = !MDLocation(line: 9, column: 5, scope: !15)
|
2015-03-03 17:24:31 +00:00
|
|
|
!19 = !MDFile(filename: "ending-run.c", directory: "/Users/echristo/tmp")
|
|
|
|
!20 = !{i32 1, !"Debug Info Version", i32 3}
|