2015-11-11 19:08:18 +01:00
; REQUIRES: object-emission
2017-09-12 00:59:45 +02:00
; RUN: %llc_dwarf < %s -filetype=obj | llvm-dwarfdump -debug-info - | FileCheck %s
2015-11-11 19:08:18 +01:00
; Given the following source, ensure that the discriminator is emitted for
; the inlined callsite.
;void xyz();
;static void __attribute__((always_inline)) bar() { xyz(); }
;void foo() {
; bar(); bar();
;}
;CHECK: DW_TAG_inlined_subroutine
;CHECK-NOT: DW_AT_GNU_discriminator
;CHECK: DW_TAG_inlined_subroutine
;CHECK-NOT: {{DW_TAG|NULL}}
;CHECK: DW_AT_GNU_discriminator{{.*}}0x01
; Function Attrs: uwtable
define void @_Z3foov ( ) #0 !dbg !4 {
tail call void @_Z3xyzv ( ) , !dbg !11
tail call void @_Z3xyzv ( ) , !dbg !13
ret void , !dbg !16
}
declare void @_Z3xyzv ( ) #1
2015-11-18 18:50:47 +01:00
attributes #0 = { uwtable "disable-tail-calls" = "false" "less-precise-fpmad" = "false" "no-frame-pointer-elim" = "false" "no-infs-fp-math" = "false" "no-nans-fp-math" = "false" "stack-protector-buffer-size" = "8" "unsafe-fp-math" = "false" "use-soft-float" = "false" }
attributes #1 = { "disable-tail-calls" = "false" "less-precise-fpmad" = "false" "no-frame-pointer-elim" = "false" "no-infs-fp-math" = "false" "no-nans-fp-math" = "false" "stack-protector-buffer-size" = "8" "unsafe-fp-math" = "false" "use-soft-float" = "false" }
2015-11-11 19:08:18 +01:00
!llvm.dbg.cu = ! { !0 }
!llvm.module.flags = ! { !8 , !9 }
!llvm.ident = ! { !10 }
2016-04-15 17:57:41 +02:00
!0 = distinct !DICompileUnit ( language: D W _ L A N G _ C _ p l u s _ p l u s , file: !1 , producer: "clang version 3.8.0 (trunk 252497)" , isOptimized: true , runtimeVersion: 0 , emissionKind: F u l l D e b u g , enums: !2 )
2015-11-11 19:08:18 +01:00
!1 = !DIFile ( filename: "a.cc" , directory: "/tmp" )
!2 = ! { }
[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 04:40:45 +02:00
!4 = distinct !DISubprogram ( name: "foo" , linkageName: "_Z3foov" , scope: !1 , file: !1 , line: 3 , type: !5 , isLocal: false , isDefinition: true , scopeLine: 3 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , retainedNodes: !2 )
2015-11-11 19:08:18 +01:00
!5 = !DISubroutineType ( types: !6 )
!6 = ! { null }
[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 04:40:45 +02:00
!7 = distinct !DISubprogram ( name: "bar" , linkageName: "_ZL3barv" , scope: !1 , file: !1 , line: 2 , type: !5 , isLocal: true , isDefinition: true , scopeLine: 2 , flags: D I F l a g P r o t o t y p e d , isOptimized: true , unit: !0 , retainedNodes: !2 )
2015-11-11 19:08:18 +01:00
!8 = ! { i32 2 , !"Dwarf Version" , i32 4 }
!9 = ! { i32 2 , !"Debug Info Version" , i32 3 }
!10 = ! { !"clang version 3.8.0 (trunk 252497)" }
!11 = !DILocation ( line: 2 , column: 52 , scope: !7 , inlinedAt: !12 )
!12 = distinct !DILocation ( line: 4 , column: 3 , scope: !4 )
!13 = !DILocation ( line: 2 , column: 52 , scope: !7 , inlinedAt: !14 )
!14 = distinct !DILocation ( line: 4 , column: 10 , scope: !15 )
!15 = !DILexicalBlockFile ( scope: !4 , file: !1 , discriminator: 1 )
!16 = !DILocation ( line: 5 , column: 1 , scope: !4 )