2014-02-27 07:44:45 +00:00
; REQUIRES: object-emission
2014-08-06 18:24:19 +00:00
; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump - | FileCheck %s
2014-02-27 07:44:45 +00:00
2014-09-19 17:03:16 +00:00
; Generated from the following source compiled with clang++ -gmlt:
; void f1() {}
; void __attribute__((section("__TEXT,__bar"))) f2() {}
; void __attribute__((always_inline)) f3() { f1(); }
; void f4() { f3(); }
2014-02-27 07:44:45 +00:00
2014-08-06 18:24:19 +00:00
; Check that
2014-09-19 17:03:16 +00:00
; * -gmlt includes no DW_TAG_subprograms for subprograms without inlined
; subroutines.
; * yet still produces DW_AT_ranges and a range list in debug_ranges that
; describes those subprograms
2014-02-27 07:44:45 +00:00
; CHECK: DW_TAG_compile_unit
2014-10-23 04:08:34 +00:00
; CHECK: DW_AT_ranges [DW_FORM_sec_offset] (0x00000000
2014-09-19 04:30:36 +00:00
; CHECK-NOT: {{DW_TAG|NULL}}
2014-09-19 17:03:16 +00:00
Disable the -gmlt optimization implemented in r218129 under Darwin due to issues with dsymutil.
r218129 omits DW_TAG_subprograms which have no inlined subroutines when
emitting -gmlt data. This makes -gmlt very low cost for -O0 builds.
Darwin's dsymutil reasonably considers a CU empty if it has no
subprograms (which occurs with the above optimization in -O0 programs
without any force_inline function calls) and drops the line table, CU,
and everything in this situation, making backtraces impossible.
Until dsymutil is modified to account for this, disable this
optimization on Darwin to preserve the desired functionality.
(see r218545, which should be reverted after this patch, for other
discussion/details)
Footnote:
In the long term, it doesn't look like this scheme (of simplified debug
info to describe inlining to enable backtracing) is tenable, it is far
too size inefficient for optimized code (the DW_TAG_inlined_subprograms,
even once compressed, are nearly twice as large as the line table
itself (also compressed)) and we'll be considering things like Cary's
two level line table proposal to encode all this information directly in
the line table.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@218702 91177308-0d34-0410-b5e6-96231b3b80d8
2014-09-30 21:28:32 +00:00
; Omitting the subprograms without inlined subroutines is not possible
; currently on Darwin as dsymutil will drop the whole CU if it has no subprograms
; (which happens with this optimization if there are no inlined subroutines).
; DARWIN: DW_TAG_subprogram
; DARWIN-NOT: DW_TAG
; DARWIN: DW_AT_name {{.*}} "f1"
; DARWIN-NOT: {{DW_TAG|NULL}}
; DARWIN: DW_TAG_subprogram
; DARWIN-NOT: DW_TAG
; DARWIN: DW_AT_name {{.*}} "f2"
; DARWIN-NOT: {{DW_TAG|NULL}}
; DARWIN: DW_TAG_subprogram
; DARWIN-NOT: DW_TAG
; Can't check the abstract_origin value across the DARWIN/CHECK checking and
; ordering, so don't bother - just trust me, it refers to f3 down there.
; DARWIN: DW_AT_abstract_origin
; DARWIN-NOT: {{DW_TAG|NULL}}
2014-09-19 17:03:16 +00:00
; FIXME: Emitting separate abstract definitions is inefficient when we could
; just attach the DW_AT_name to the inlined_subroutine directly. Except that
; would produce many string relocations. Implement string indexing in the
; skeleton CU to address the relocation problem, then remove abstract
; definitions from -gmlt here.
2014-10-06 03:36:31 +00:00
; CHECK: DW_TAG_subprogram
2014-09-19 17:03:16 +00:00
; CHECK-NEXT: DW_AT_name {{.*}} "f3"
; FIXME: We don't really need DW_AT_inline, consumers can ignore this due to
; the absence of high_pc/low_pc/ranges and know that they just need it for
; retrieving the name of a concrete inlined instance
; CHECK-NOT: {{DW_TAG|DW_AT|NULL}}
2014-09-19 04:30:36 +00:00
; Check that we only provide the minimal attributes on a subprogram to save space.
; CHECK: DW_TAG_subprogram
; CHECK-NEXT: DW_AT_low_pc
; CHECK-NEXT: DW_AT_high_pc
; CHECK-NEXT: DW_AT_name
2014-09-19 17:03:16 +00:00
; CHECK-NOT: {{DW_TAG|DW_AT}}
; CHECK: DW_TAG_inlined_subroutine
; As mentioned above - replace DW_AT_abstract_origin with DW_AT_name to save
; space once we have support for string indexing in non-dwo sections
2014-10-06 03:36:31 +00:00
; CHECK-NEXT: DW_AT_abstract_origin {{.*}} "f3"
2014-09-19 17:03:16 +00:00
; CHECK-NEXT: DW_AT_low_pc
; CHECK-NEXT: DW_AT_high_pc
; CHECK-NEXT: DW_AT_call_file
; CHECK-NEXT: DW_AT_call_line
; Make sure we don't have any other subprograms here (subprograms with no
; inlined subroutines are omitted by design to save space)
2014-02-27 07:44:45 +00:00
2014-09-19 17:03:16 +00:00
; CHECK-NOT: {{DW_TAG|DW_AT}}
; CHECK: NULL
; CHECK-NOT: {{DW_TAG|DW_AT}}
; CHECK: NULL
2014-02-27 07:44:45 +00:00
; CHECK: .debug_ranges contents:
2014-09-19 18:31:25 +00:00
; ... some addresses (depends on platform (such as platforms with function
; reordering in the linker), and looks wonky on platforms with zero values
; written in relocation places (dumper needs to be fixed to read the
; relocations rather than interpret that as the end of a range list))
2014-09-19 17:03:16 +00:00
; CHECK: 00000000 <End of list>
2014-09-19 18:31:25 +00:00
2014-02-27 07:44:45 +00:00
2014-08-06 18:24:19 +00:00
; Check that we don't emit any pubnames or pubtypes under -gmlt
2014-03-12 03:34:38 +00:00
; CHECK: .debug_pubnames contents:
; CHECK-NOT: Offset
; CHECK: .debug_pubtypes contents:
; CHECK-NOT: Offset
2014-11-14 16:15:53 +00:00
; CHECK: .apple{{.*}} contents:
2014-02-27 07:44:45 +00:00
; Function Attrs: nounwind uwtable
2014-09-19 17:03:16 +00:00
define void @_Z2f1v ( ) #0 {
entry:
ret void , !dbg !13
}
; Function Attrs: nounwind uwtable
define void @_Z2f2v ( ) #0 section "__TEXT,__bar" {
entry:
ret void , !dbg !14
}
; Function Attrs: alwaysinline nounwind uwtable
define void @_Z2f3v ( ) #1 {
2014-02-27 07:44:45 +00:00
entry:
2014-09-19 17:03:16 +00:00
call void @_Z2f1v ( ) , !dbg !15
ret void , !dbg !16
2014-02-27 07:44:45 +00:00
}
2014-08-06 18:24:19 +00:00
; Function Attrs: nounwind uwtable
2014-09-19 17:03:16 +00:00
define void @_Z2f4v ( ) #0 {
2014-08-06 18:24:19 +00:00
entry:
2014-09-19 17:03:16 +00:00
call void @_Z2f1v ( ) #2 , !dbg !17
ret void , !dbg !19
2014-08-06 18:24:19 +00:00
}
2014-02-27 07:44:45 +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" }
2014-09-19 17:03:16 +00:00
attributes #1 = { alwaysinline 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 #2 = { nounwind }
2014-02-27 07:44:45 +00:00
!llvm.dbg.cu = ! { !0 }
2014-09-19 17:03:16 +00:00
!llvm.module.flags = ! { !10 , !11 }
!llvm.ident = ! { !12 }
2014-02-27 07:44:45 +00:00
2015-04-29 16:38:44 +00:00
!0 = !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , producer: "clang version 3.6.0 " , isOptimized: false , emissionKind: 2 , file: !1 , enums: !2 , retainedTypes: !2 , subprograms: !3 , globals: !2 , imports: !2 )
!1 = !DIFile ( filename: "gmlt.cpp" , directory: "/tmp/dbginfo" )
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
!2 = ! { }
!3 = ! { !4 , !7 , !8 , !9 }
2015-04-29 16:38:44 +00:00
!4 = !DISubprogram ( name: "f1" , line: 1 , isLocal: false , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , scopeLine: 1 , file: !1 , scope: !5 , type: !6 , function: void ( ) * @_Z2f1v , variables: !2 )
!5 = !DIFile ( filename: "gmlt.cpp" , directory: "/tmp/dbginfo" )
!6 = !DISubroutineType ( types: !2 )
!7 = !DISubprogram ( name: "f2" , line: 2 , isLocal: false , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , scopeLine: 2 , file: !1 , scope: !5 , type: !6 , function: void ( ) * @_Z2f2v , variables: !2 )
!8 = !DISubprogram ( name: "f3" , 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: false , scopeLine: 3 , file: !1 , scope: !5 , type: !6 , function: void ( ) * @_Z2f3v , variables: !2 )
!9 = !DISubprogram ( name: "f4" , line: 4 , isLocal: false , isDefinition: true , virtualIndex: 6 , flags: D I F l a g P r o t o t y p e d , isOptimized: false , scopeLine: 4 , file: !1 , scope: !5 , type: !6 , function: void ( ) * @_Z2f4v , variables: !2 )
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
!10 = ! { i32 2 , !"Dwarf Version" , i32 4 }
2015-03-03 17:24:31 +00:00
!11 = ! { i32 2 , !"Debug Info Version" , i32 3 }
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 = ! { !"clang version 3.6.0 " }
2015-04-29 16:38:44 +00:00
!13 = !DILocation ( line: 1 , column: 12 , scope: !4 )
!14 = !DILocation ( line: 2 , column: 53 , scope: !7 )
!15 = !DILocation ( line: 3 , column: 44 , scope: !8 )
!16 = !DILocation ( line: 3 , column: 50 , scope: !8 )
!17 = !DILocation ( line: 3 , column: 44 , scope: !8 , inlinedAt: !18 )
!18 = !DILocation ( line: 4 , column: 13 , scope: !9 )
!19 = !DILocation ( line: 4 , column: 19 , scope: !9 )