2011-04-21 23:22:35 +00:00
; RUN: llc < %s - | FileCheck %s
target datalayout = "e-p:32:32:32-i1:8:32-i8:8:32-i16:16:32-i32:32:32-i64:32:32-f32:32:32-f64:32:32-v64:32:64-v128:32:128-a0:0:32-n32"
target triple = "thumbv7-apple-macosx10.6.7"
2015-01-12 22:19:22 +00:00
;CHECK: sub-register DW_OP_regx
2015-03-02 22:02:33 +00:00
;CHECK-NEXT: 256
2014-02-27 17:56:08 +00:00
;CHECK-NEXT: DW_OP_piece
2015-03-02 22:02:33 +00:00
;CHECK-NEXT: 8
2015-01-12 22:19:22 +00:00
;CHECK-NEXT: sub-register DW_OP_regx
2015-03-02 22:02:33 +00:00
;CHECK-NEXT: 257
2014-02-27 17:56:08 +00:00
;CHECK-NEXT: DW_OP_piece
2015-03-02 22:02:33 +00:00
;CHECK-NEXT: 8
2011-04-21 23:22:35 +00:00
@.str = external constant [ 13 x i8 ]
declare < 4 x float > @test0001 ( float ) nounwind readnone ssp
define i32 @main ( i32 %argc , i8 * * nocapture %argv ) nounwind ssp {
entry:
br label %for.body9
for.body9: ; preds = %for.body9, %entry
%add19 = fadd < 4 x float > undef , < float 0.000000e+00 , float 0.000000e+00 , float 0.000000e+00 , float 1.000000e+00 > , !dbg !39
br i1 undef , label %for.end54 , label %for.body9 , !dbg !44
for.end54: ; preds = %for.body9
2015-03-03 17:24:31 +00:00
tail call void @llvm.dbg.value ( metadata < 4 x float > %add19 , i64 0 , metadata !27 , metadata !MDExpression ( ) ) , !dbg !39
2011-04-21 23:22:35 +00:00
%tmp115 = extractelement < 4 x float > %add19 , i32 1
%conv6.i75 = fpext float %tmp115 to double , !dbg !45
%call.i82 = tail call i32 ( i8 * , . . . ) * @printf ( i8 * getelementptr inbounds ( [ 13 x i8 ] * @.str , i32 0 , i32 0 ) , double undef , double %conv6.i75 , double undef , double undef ) nounwind , !dbg !45
ret i32 0 , !dbg !49
}
declare i32 @printf ( i8 * nocapture , . . . ) nounwind
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
2011-04-21 23:22:35 +00:00
2013-03-08 00:23:31 +00:00
!llvm.dbg.cu = ! { !2 }
2013-11-22 21:49:45 +00:00
!llvm.module.flags = ! { !56 }
2011-04-21 23:22:35 +00:00
2015-03-03 17:24:31 +00:00
!0 = !MDSubprogram ( name: "test0001" , line: 3 , 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 , scopeLine: 3 , file: !54 , scope: !1 , type: !3 , function: < 4 x float > ( float ) * @test0001 , variables: !51 )
!1 = !MDFile ( filename: "build2.c" , directory: "/private/tmp" )
!2 = !MDCompileUnit ( language: D W _ L A N G _ C 99 , producer: "clang version 3.0 (trunk 129915)" , isOptimized: true , emissionKind: 1 , file: !54 , enums: !17 , retainedTypes: !17 , subprograms: !50 , imports: null )
!3 = !MDSubroutineType ( 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.
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
!4 = ! { !5 }
2015-03-03 17:24:31 +00:00
!5 = !MDDerivedType ( tag: D W _ T A G _ t y p e d e f , name: "v4f32" , line: 14 , file: !54 , scope: !2 , baseType: !6 )
!6 = !MDCompositeType ( tag: D W _ T A G _ a r r a y _ type , size: 128 , align: 128 , file: !2 , baseType: !7 , elements: !8 )
!7 = !MDBasicType ( tag: D W _ T A G _ b a s e _ type , name: "float" , size: 32 , align: 32 , encoding: D W _ A T E _ float )
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 }
2015-03-03 17:24:31 +00:00
!9 = !MDSubrange ( count: 4 )
!10 = !MDSubprogram ( name: "main" , line: 59 , 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 , scopeLine: 59 , file: !54 , scope: !1 , type: !11 , function: i32 ( i32 , i8 * * ) * @main , variables: !52 )
!11 = !MDSubroutineType ( types: !12 )
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
!12 = ! { !13 }
2015-03-03 17:24:31 +00:00
!13 = !MDBasicType ( 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 )
!14 = !MDSubprogram ( name: "printFV" , line: 41 , isLocal: true , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , scopeLine: 41 , file: !55 , scope: !15 , type: !16 , variables: !53 )
!15 = !MDFile ( filename: "/Volumes/Lalgate/work/llvm/projects/llvm-test/SingleSource/UnitTests/Vector/helpers.h" , directory: "/private/tmp" )
!16 = !MDSubroutineType ( types: !17 )
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
!17 = ! { null }
2015-03-03 17:24:31 +00:00
!18 = !MDLocalVariable ( tag: D W _ T A G _ a r g _ v a r i a b l e , name: "a" , line: 3 , arg: 1 , scope: !0 , file: !1 , type: !7 )
!19 = !MDLocalVariable ( tag: D W _ T A G _ a r g _ v a r i a b l e , name: "argc" , line: 59 , arg: 1 , scope: !10 , file: !1 , type: !13 )
!20 = !MDLocalVariable ( tag: D W _ T A G _ a r g _ v a r i a b l e , name: "argv" , line: 59 , arg: 2 , scope: !10 , file: !1 , type: !21 )
!21 = !MDDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 32 , align: 32 , scope: !2 , baseType: !22 )
!22 = !MDDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 32 , align: 32 , scope: !2 , baseType: !23 )
!23 = !MDBasicType ( tag: D W _ T A G _ b a s e _ type , name: "char" , size: 8 , align: 8 , encoding: D W _ A T E _ s i g n e d _ c h a r )
!24 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "i" , line: 60 , scope: !25 , file: !1 , type: !13 )
!25 = distinct !MDLexicalBlock ( line: 59 , column: 33 , file: !54 , scope: !10 )
!26 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "j" , line: 60 , scope: !25 , file: !1 , type: !13 )
!27 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "x" , line: 61 , scope: !25 , file: !1 , type: !5 )
!28 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "y" , line: 62 , scope: !25 , file: !1 , type: !5 )
!29 = !MDLocalVariable ( tag: D W _ T A G _ a u t o _ v a r i a b l e , name: "z" , line: 63 , scope: !25 , file: !1 , type: !5 )
!30 = !MDLocalVariable ( tag: D W _ T A G _ a r g _ v a r i a b l e , name: "F" , line: 41 , arg: 1 , scope: !14 , file: !15 , type: !31 )
!31 = !MDDerivedType ( tag: D W _ T A G _ p o i n t e r _ type , size: 32 , align: 32 , scope: !2 , baseType: !32 )
!32 = !MDDerivedType ( tag: D W _ T A G _ t y p e d e f , name: "FV" , line: 25 , file: !55 , scope: !2 , baseType: !33 )
!33 = !MDCompositeType ( tag: D W _ T A G _ u n i o n _ type , line: 22 , size: 128 , align: 128 , file: !55 , scope: !2 , elements: !34 )
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
!34 = ! { !35 , !37 }
2015-03-03 17:24:31 +00:00
!35 = !MDDerivedType ( tag: D W _ T A G _ m e m b e r , name: "V" , line: 23 , size: 128 , align: 128 , file: !55 , scope: !15 , baseType: !36 )
!36 = !MDDerivedType ( tag: D W _ T A G _ t y p e d e f , name: "v4sf" , line: 3 , file: !55 , scope: !2 , baseType: !6 )
!37 = !MDDerivedType ( tag: D W _ T A G _ m e m b e r , name: "A" , line: 24 , size: 128 , align: 32 , file: !55 , scope: !15 , baseType: !38 )
!38 = !MDCompositeType ( tag: D W _ T A G _ a r r a y _ type , size: 128 , align: 32 , scope: !2 , baseType: !7 , elements: !8 )
2015-01-14 22:27:36 +00:00
!39 = !MDLocation ( line: 79 , column: 7 , scope: !40 )
2015-03-03 17:24:31 +00:00
!40 = distinct !MDLexicalBlock ( line: 75 , column: 35 , file: !54 , scope: !41 )
!41 = distinct !MDLexicalBlock ( line: 75 , column: 5 , file: !54 , scope: !42 )
!42 = distinct !MDLexicalBlock ( line: 71 , column: 32 , file: !54 , scope: !43 )
!43 = distinct !MDLexicalBlock ( line: 71 , column: 3 , file: !54 , scope: !25 )
2015-01-14 22:27:36 +00:00
!44 = !MDLocation ( line: 75 , column: 5 , scope: !42 )
!45 = !MDLocation ( line: 42 , column: 2 , scope: !46 , inlinedAt: !48 )
2015-03-03 17:24:31 +00:00
!46 = distinct !MDLexicalBlock ( line: 42 , column: 2 , file: !55 , scope: !47 )
!47 = distinct !MDLexicalBlock ( line: 41 , column: 28 , file: !55 , scope: !14 )
2015-01-14 22:27:36 +00:00
!48 = !MDLocation ( line: 95 , column: 3 , scope: !25 )
!49 = !MDLocation ( line: 99 , column: 3 , scope: !25 )
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
!50 = ! { !0 , !10 , !14 }
!51 = ! { !18 }
!52 = ! { !19 , !20 , !24 , !26 , !27 , !28 , !29 }
!53 = ! { !30 }
2015-03-03 17:24:31 +00:00
!54 = !MDFile ( filename: "build2.c" , directory: "/private/tmp" )
!55 = !MDFile ( filename: "/Volumes/Lalgate/work/llvm/projects/llvm-test/SingleSource/UnitTests/Vector/helpers.h" , directory: "/private/tmp" )
!56 = ! { i32 1 , !"Debug Info Version" , i32 3 }