2011-09-09 06:59:09 +08:00
; RUN: llc < %s | FileCheck %s
; Test to check argument y's debug info uses FI
; Radar 10048772
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:64-f32:32:32-f64:32:64-v64:32:64-v128:32:128-a0:0:32-n32"
2012-01-04 09:55:04 +08:00
target triple = "thumbv7-apple-ios"
2011-09-09 06:59:09 +08:00
%struct.tag_s = type { i32 , i32 , i32 }
2015-11-06 06:03:56 +08:00
define void @foo ( %struct.tag_s * nocapture %this , %struct.tag_s * %c , i64 %x , i64 %y , %struct.tag_s * nocapture %ptr1 , %struct.tag_s * nocapture %ptr2 ) nounwind ssp !dbg !1 {
2015-04-30 00:38:44 +08:00
tail call void @llvm.dbg.value ( metadata %struct.tag_s * %this , i64 0 , metadata !5 , metadata !DIExpression ( ) ) , !dbg !20
tail call void @llvm.dbg.value ( metadata %struct.tag_s * %c , i64 0 , metadata !13 , metadata !DIExpression ( ) ) , !dbg !21
tail call void @llvm.dbg.value ( metadata i64 %x , i64 0 , metadata !14 , metadata !DIExpression ( ) ) , !dbg !22
tail call void @llvm.dbg.value ( metadata i64 %y , i64 0 , metadata !17 , metadata !DIExpression ( ) ) , !dbg !23
2015-11-18 00:01:28 +08:00
;CHECK: @DEBUG_VALUE: foo:y <- [%R7+8]
2015-04-30 00:38:44 +08:00
tail call void @llvm.dbg.value ( metadata %struct.tag_s * %ptr1 , i64 0 , metadata !18 , metadata !DIExpression ( ) ) , !dbg !24
tail call void @llvm.dbg.value ( metadata %struct.tag_s * %ptr2 , i64 0 , metadata !19 , metadata !DIExpression ( ) ) , !dbg !25
2011-09-09 06:59:09 +08:00
%1 = icmp eq %struct.tag_s * %c , null , !dbg !26
br i1 %1 , label %3 , label %2 , !dbg !26
; <label>:2 ; preds = %0
tail call void @foobar ( i64 %x , i64 %y ) nounwind , !dbg !28
br label %3 , !dbg !28
; <label>:3 ; preds = %0, %2
ret void , !dbg !29
}
declare void @foobar ( i64 , i64 )
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 ) nounwind readnone
2011-09-09 06:59:09 +08:00
!llvm.dbg.cu = ! { !0 }
2013-11-23 05:49:45 +08:00
!llvm.module.flags = ! { !33 }
2011-09-09 06:59:09 +08:00
2016-04-15 23:57:41 +08:00
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C 99 , producer: "Apple clang version 3.0 (tags/Apple/clang-211.10.1) (based on LLVM 3.0svn)" , isOptimized: true , emissionKind: F u l l D e b u g , file: !32 , enums: ! { } , retainedTypes: ! { } , imports: null )
!1 = distinct !DISubprogram ( name: "foo" , line: 11 , isLocal: false , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , scopeLine: 11 , file: !2 , scope: !2 , type: !3 , variables: !31 )
2015-04-30 00:38:44 +08:00
!2 = !DIFile ( filename: "one.c" , directory: "/Volumes/Athwagate/R10048772" )
!3 = !DISubroutineType ( types: !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.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!4 = ! { null }
2015-08-01 02:58:39 +08:00
!5 = !DILocalVariable ( name: "this" , line: 11 , arg: 1 , scope: !1 , file: !2 , type: !6 )
2015-04-30 00:38:44 +08:00
!6 = !DIDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 32 , align: 32 , scope: !0 , baseType: !7 )
!7 = !DICompositeType ( tag: D W _ T A G _ s t r u c t u r e _ type , name: "tag_s" , line: 5 , size: 96 , align: 32 , file: !32 , scope: !0 , elements: !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.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!8 = ! { !9 , !11 , !12 }
2015-04-30 00:38:44 +08:00
!9 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "x" , line: 6 , size: 32 , align: 32 , file: !32 , scope: !7 , baseType: !10 )
!10 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "int" , size: 32 , align: 32 , encoding: D W _ A T E _ s i g n e d )
!11 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "y" , line: 7 , size: 32 , align: 32 , offset: 32 , file: !32 , scope: !7 , baseType: !10 )
!12 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "z" , line: 8 , size: 32 , align: 32 , offset: 64 , file: !32 , scope: !7 , baseType: !10 )
2015-08-01 02:58:39 +08:00
!13 = !DILocalVariable ( name: "c" , line: 11 , arg: 2 , scope: !1 , file: !2 , type: !6 )
!14 = !DILocalVariable ( name: "x" , line: 11 , arg: 3 , scope: !1 , file: !2 , type: !15 )
2015-04-30 00:38:44 +08:00
!15 = !DIDerivedType ( tag: D W _ T A G _ t y p e d e f , name: "UInt64" , line: 1 , file: !32 , scope: !0 , baseType: !16 )
!16 = !DIBasicType ( tag: D W _ T A G _ b a s e _ type , name: "long long unsigned int" , size: 64 , align: 32 , encoding: D W _ A T E _ u n s i g n e d )
2015-08-01 02:58:39 +08:00
!17 = !DILocalVariable ( name: "y" , line: 11 , arg: 4 , scope: !1 , file: !2 , type: !15 )
!18 = !DILocalVariable ( name: "ptr1" , line: 11 , arg: 5 , scope: !1 , file: !2 , type: !6 )
!19 = !DILocalVariable ( name: "ptr2" , line: 11 , arg: 6 , scope: !1 , file: !2 , type: !6 )
2015-04-30 00:38:44 +08:00
!20 = !DILocation ( line: 11 , column: 24 , scope: !1 )
!21 = !DILocation ( line: 11 , column: 44 , scope: !1 )
!22 = !DILocation ( line: 11 , column: 54 , scope: !1 )
!23 = !DILocation ( line: 11 , column: 64 , scope: !1 )
!24 = !DILocation ( line: 11 , column: 81 , scope: !1 )
!25 = !DILocation ( line: 11 , column: 101 , scope: !1 )
!26 = !DILocation ( line: 12 , column: 3 , scope: !27 )
!27 = distinct !DILexicalBlock ( line: 11 , column: 107 , file: !2 , scope: !1 )
!28 = !DILocation ( line: 13 , column: 5 , scope: !27 )
!29 = !DILocation ( line: 14 , column: 1 , scope: !27 )
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.
llvm-svn: 224257
2014-12-16 03:07:53 +08:00
!31 = ! { !5 , !13 , !14 , !17 , !18 , !19 }
2015-04-30 00:38:44 +08:00
!32 = !DIFile ( filename: "one.c" , directory: "/Volumes/Athwagate/R10048772" )
2015-03-04 01:24:31 +08:00
!33 = ! { i32 1 , !"Debug Info Version" , i32 3 }