2013-07-25 02:56:43 +08:00
; RUN: llc -O0 %s -mtriple=x86_64-apple-darwin -filetype=obj -o %t
2017-09-12 07:05:20 +08:00
; RUN: llvm-dwarfdump -v %t | FileCheck %s
2013-02-02 07:54:37 +08:00
; rdar://13071590
; Check we are not emitting mutliple AT_const_value for a single member.
; CHECK: .debug_info contents:
; CHECK: DW_TAG_compile_unit
; CHECK: DW_TAG_class_type
; CHECK: DW_TAG_member
; CHECK: badbit
2013-08-28 07:49:04 +08:00
; CHECK: DW_AT_const_value [DW_FORM_sdata] (1)
2013-02-02 07:54:37 +08:00
; CHECK-NOT: DW_AT_const_value
; CHECK: NULL
%"class.std::basic_ostream" = type { i32 ( . . . ) * * , %"class.std::basic_os" }
%"class.std::basic_os" = type { %"class.std::os_base" , %"class.std::basic_ostream" * , i8 , i8 }
%"class.std::os_base" = type { i32 ( . . . ) * * , i64 , i64 , i32 , i32 , i32 }
@_ZSt4cout = external global %"class.std::basic_ostream"
@.str = private unnamed_addr constant [ 6 x i8 ] c "c is \00" , align 1
2015-11-06 06:03:56 +08:00
define i32 @main ( ) !dbg !960 {
2013-02-02 07:54:37 +08:00
entry:
2015-03-14 02:20:45 +08:00
%call1.i = tail call %"class.std::basic_ostream" * @test ( %"class.std::basic_ostream" * @_ZSt4cout , i8 * getelementptr inbounds ( [ 6 x i8 ] , [ 6 x i8 ] * @.str , i64 0 , i64 0 ) , i64 5 )
2013-02-02 07:54:37 +08:00
ret i32 0
}
declare %"class.std::basic_ostream" * @test ( %"class.std::basic_ostream" * , i8 * , i64 )
2017-07-29 04:21:02 +08:00
declare void @llvm.dbg.value ( metadata , metadata , metadata ) nounwind readnone
2013-02-02 07:54:37 +08:00
!llvm.dbg.cu = ! { !0 }
2013-11-23 05:49:45 +08:00
!llvm.module.flags = ! { !1803 }
2013-02-02 07:54:37 +08:00
2016-04-15 23:57:41 +08:00
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , producer: "clang version 3.3 (trunk 174207)" , isOptimized: true , emissionKind: F u l l D e b u g , file: !1802 , enums: !1 , retainedTypes: !955 , globals: !1786 , imports: !955 )
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
!1 = ! { !26 }
2017-04-29 06:25:46 +08:00
!4 = !DINamespace ( name: "std" , scope: !5 )
2015-04-30 00:38:44 +08:00
!5 = !DIFile ( filename: "os_base.h" , directory: "/privite/tmp" )
!25 = !DIEnumerator ( name: "_S_os_fmtflags_end" , value: 65536 ) ; [ DW_TAG_enumerator ]
!26 = !DICompositeType ( tag: D W _ T A G _ e n u m e r a t i o n _ type , name: "_Ios_Iostate" , line: 146 , size: 32 , align: 32 , file: !1801 , scope: !4 , elements: !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
!27 = ! { !28 , !29 , !30 , !31 , !32 }
2015-04-30 00:38:44 +08:00
!28 = !DIEnumerator ( name: "_S_goodbit" , value: 0 ) ; [ DW_TAG_enumerator ] [_S_goodbit :: 0]
!29 = !DIEnumerator ( name: "_S_badbit" , value: 1 ) ; [ DW_TAG_enumerator ] [_S_badbit :: 1]
!30 = !DIEnumerator ( name: "_S_eofbit" , value: 2 ) ; [ DW_TAG_enumerator ] [_S_eofbit :: 2]
!31 = !DIEnumerator ( name: "_S_failbit" , value: 4 ) ; [ DW_TAG_enumerator ] [_S_failbit :: 4]
!32 = !DIEnumerator ( name: "_S_os_ostate_end" , value: 65536 ) ; [ DW_TAG_enumerator ] [_S_os_ostate_end :: 65536]
!49 = !DICompositeType ( tag: D W _ T A G _ c l a s s _ type , name: "os_base" , line: 200 , size: 1728 , align: 64 , file: !1801 , scope: !4 , elements: !50 , vtableHolder: !49 )
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
!50 = ! { !77 }
2015-04-30 00:38:44 +08:00
!54 = !DISubroutineType ( types: !55 )
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
!55 = ! { !56 }
2015-04-30 00:38:44 +08:00
!56 = !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 )
!77 = !DIDerivedType ( tag: D W _ T A G _ m e m b e r , name: "badbit" , line: 331 , flags: D I F l a g S t a t i c M e m b e r , file: !1801 , scope: !49 , baseType: !78 , extraData: i32 1 )
!78 = !DIDerivedType ( tag: D W _ T A G _ c o n s t _ type , baseType: !79 )
!79 = !DIDerivedType ( tag: D W _ T A G _ t y p e d e f , name: "ostate" , line: 327 , file: !1801 , scope: !49 , baseType: !26 )
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
!955 = ! { }
[DebugInfo] Add DILabel metadata and intrinsic llvm.dbg.label.
In order to set breakpoints on labels and list source code around
labels, we need collect debug information for labels, i.e., label
name, the function label belong, line number in the file, and the
address label located. In order to keep these information in LLVM
IR and to allow backend to generate debug information correctly.
We create a new kind of metadata for labels, DILabel. The format
of DILabel is
!DILabel(scope: !1, name: "foo", file: !2, line: 3)
We hope to keep debug information as much as possible even the
code is optimized. So, we create a new kind of intrinsic for label
metadata to avoid the metadata is eliminated with basic block.
The intrinsic will keep existing if we keep it from optimized out.
The format of the intrinsic is
llvm.dbg.label(metadata !1)
It has only one argument, that is the DILabel metadata. The
intrinsic will follow the label immediately. Backend could get the
label metadata through the intrinsic's parameter.
We also create DIBuilder API for labels to be used by Frontend.
Frontend could use createLabel() to allocate DILabel objects, and use
insertLabel() to insert llvm.dbg.label intrinsic in LLVM IR.
Differential Revision: https://reviews.llvm.org/D45024
Patch by Hsiangkai Wang.
llvm-svn: 331841
2018-05-09 10:40:45 +08:00
!960 = distinct !DISubprogram ( name: "main" , line: 73 , 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: 73 , file: !1802 , scope: null , type: !54 , retainedNodes: !955 )
2015-04-30 00:38:44 +08:00
!961 = !DIFile ( filename: "student2.cpp" , directory: "/privite/tmp" )
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
!1786 = ! { !1800 }
2016-12-20 10:09:43 +08:00
!1800 = !DIGlobalVariableExpression ( var: !1804 , expr: !DIExpression ( D W _ O P _ c o n s t u , 1 , D W _ O P _ s t a c k _ v a l u e ) )
2015-04-30 00:38:44 +08:00
!1801 = !DIFile ( filename: "os_base.h" , directory: "/privite/tmp" )
!1802 = !DIFile ( filename: "student2.cpp" , directory: "/privite/tmp" )
2015-03-04 01:24:31 +08:00
!1803 = ! { i32 1 , !"Debug Info Version" , i32 3 }
2016-12-20 10:09:43 +08:00
!1804 = distinct !DIGlobalVariable ( name: "badbit" , linkageName: "badbit" , line: 331 , isLocal: true , isDefinition: true , scope: !5 , file: !5 , type: !78 , declaration: !77 )