reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
   69
   70
   71
   72
   73
   74
   75
   76
   77
   78
   79
   80
   81
   82
   83
   84
   85
   86
   87
   88
   89
   90
   91
   92
   93
   94
   95
   96
   97
   98
   99
  100
  101
  102
  103
  104
  105
  106
  107
  108
  109
  110
  111
  112
  113
  114
  115
  116
  117
  118
  119
  120
  121
  122
  123
  124
  125
  126
  127
  128
  129
  130
  131
  132
  133
  134
  135
  136
  137
  138
  139
  140
  141
  142
  143
  144
  145
  146
  147
  148
  149
  150
  151
  152
  153
  154
  155
  156
  157
  158
  159
  160
  161
; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj -O0 < %s  | llvm-dwarfdump -v -debug-info - | FileCheck %s

;; This test checks that Inlined DILexicalBlockFile with local decl entry
;; is skipped and only one DW_TAG_lexical_block is generated.
;; This test is special because it contains DILexicalBlockFile that has a
;; DILexicalBlockFile as a parent scope.
;;
;; This test was generated by running following command:
;; clang -cc1 -O0 -debug-info-kind=limited -dwarf-version=4 -emit-llvm test.cpp
;; Where test.cpp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;namespace N {}
;; __attribute__((always_inline)) int bar() {
;;  {
;;    int y;
;;#line 1 "test.h"
;;    using namespace N;
;;    while (y < 0) return 2;
;;    return 0;
;;  }
;;}
;;int foo() {  
;;  return bar();
;;}
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;; Concrete "bar" function
; CHECK:    DW_TAG_subprogram
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:      DW_AT_abstract_origin {{.*}} {[[Offset_bar:0x[0-9abcdef]+]]}
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:      DW_TAG_lexical_block
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:        DW_TAG_variable
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:        DW_TAG_imported_module

;; Abstract "bar" function
; CHECK:    [[Offset_bar]]: DW_TAG_subprogram
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:      DW_AT_name {{.*}} "bar"
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:      DW_AT_inline
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:      DW_TAG_lexical_block
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:        DW_TAG_variable
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:        DW_TAG_imported_module

; CHECK:    DW_TAG_subprogram
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:      DW_AT_name {{.*}} "foo"
; CHECK-NOT: {{NULL}}

;; Inlined "bar" function
; CHECK:      DW_TAG_inlined_subroutine
; CHECK-NEXT:   DW_AT_abstract_origin {{.*}} {[[Offset_bar]]}
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:        DW_TAG_lexical_block
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:          DW_TAG_variable
; CHECK-NOT: {{DW_TAG|NULL}}
; CHECK:          DW_TAG_imported_module


; Function Attrs: alwaysinline nounwind
define i32 @_Z3barv() #0 !dbg !4 {
entry:
  %retval = alloca i32, align 4
  %y = alloca i32, align 4
  call void @llvm.dbg.declare(metadata i32* %y, metadata !18, metadata !19), !dbg !20
  br label %while.cond, !dbg !21

while.cond:                                       ; preds = %entry
  %0 = load i32, i32* %y, align 4, !dbg !22
  %cmp = icmp slt i32 %0, 0, !dbg !22
  br i1 %cmp, label %while.body, label %while.end, !dbg !22

while.body:                                       ; preds = %while.cond
  store i32 2, i32* %retval, align 4, !dbg !24
  br label %return, !dbg !24

while.end:                                        ; preds = %while.cond
  store i32 0, i32* %retval, align 4, !dbg !26
  br label %return, !dbg !26

return:                                           ; preds = %while.end, %while.body
  %1 = load i32, i32* %retval, align 4, !dbg !27
  ret i32 %1, !dbg !27
}

; Function Attrs: nounwind readnone
declare void @llvm.dbg.declare(metadata, metadata, metadata) #1

; Function Attrs: nounwind
define i32 @_Z3foov() #2 !dbg !8 {
entry:
  %retval.i = alloca i32, align 4
  %y.i = alloca i32, align 4
  call void @llvm.dbg.declare(metadata i32* %y.i, metadata !18, metadata !19), !dbg !29
  %0 = load i32, i32* %y.i, align 4, !dbg !31
  %cmp.i = icmp slt i32 %0, 0, !dbg !31
  br i1 %cmp.i, label %while.body.i, label %while.end.i, !dbg !31

while.body.i:                                     ; preds = %entry
  store i32 2, i32* %retval.i, align 4, !dbg !32
  br label %_Z3barv.exit, !dbg !32

while.end.i:                                      ; preds = %entry
  store i32 0, i32* %retval.i, align 4, !dbg !33
  br label %_Z3barv.exit, !dbg !33

_Z3barv.exit:                                     ; preds = %while.end.i, %while.body.i
  %1 = load i32, i32* %retval.i, align 4, !dbg !34
  ret i32 %1, !dbg !35
}

attributes #0 = { alwaysinline nounwind }
attributes #1 = { nounwind readnone }
attributes #2 = { nounwind }

!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!15, !16}
!llvm.ident = !{!17}

!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 264349)", isOptimized: false, runtimeVersion: 0, emissionKind: 1, enums: !2, imports: !10)
!1 = !DIFile(filename: "test.cpp", directory: "/")
!2 = !{}
!4 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
!5 = !DISubroutineType(types: !6)
!6 = !{!7}
!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
!8 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !9, file: !9, line: 6, type: !5, isLocal: false, isDefinition: true, scopeLine: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
!9 = !DIFile(filename: "test.h", directory: "/")
!10 = !{!11}
!11 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !12, entity: !14, file: !1, line: 1)
!12 = !DILexicalBlockFile(scope: !13, file: !9, discriminator: 0)
!13 = distinct !DILexicalBlock(scope: !4, file: !1, line: 3)
!14 = !DINamespace(name: "N", scope: null)
!15 = !{i32 2, !"Dwarf Version", i32 4}
!16 = !{i32 2, !"Debug Info Version", i32 3}
!17 = !{!"clang version 3.9.0 (trunk 264349)"}
!18 = !DILocalVariable(name: "y", scope: !13, file: !1, line: 4, type: !7)
!19 = !DIExpression()
!20 = !DILocation(line: 4, scope: !13)
!21 = !DILocation(line: 2, scope: !12)
!22 = !DILocation(line: 2, scope: !23)
!23 = !DILexicalBlockFile(scope: !12, file: !9, discriminator: 1)
!24 = !DILocation(line: 2, scope: !25)
!25 = !DILexicalBlockFile(scope: !12, file: !9, discriminator: 2)
!26 = !DILocation(line: 3, scope: !12)
!27 = !DILocation(line: 5, scope: !28)
!28 = !DILexicalBlockFile(scope: !4, file: !9, discriminator: 0)
!29 = !DILocation(line: 4, scope: !13, inlinedAt: !30)
!30 = distinct !DILocation(line: 7, scope: !8)
!31 = !DILocation(line: 2, scope: !23, inlinedAt: !30)
!32 = !DILocation(line: 2, scope: !25, inlinedAt: !30)
!33 = !DILocation(line: 3, scope: !12, inlinedAt: !30)
!34 = !DILocation(line: 5, scope: !28, inlinedAt: !30)
!35 = !DILocation(line: 7, scope: !8)