1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-unknown-linux-gnu -filetype=obj -O0 < %s | llvm-dwarfdump -debug-dump=info - | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker;; This test checks that Inlined DILexicalBlockFile with local decl entry 4*9880d681SAndroid Build Coastguard Worker;; is skipped and only one DW_TAG_lexical_block is generated. 5*9880d681SAndroid Build Coastguard Worker;; This test is special because it contains DILexicalBlockFile that has a 6*9880d681SAndroid Build Coastguard Worker;; DILexicalBlockFile as a parent scope. 7*9880d681SAndroid Build Coastguard Worker;; 8*9880d681SAndroid Build Coastguard Worker;; This test was generated by running following command: 9*9880d681SAndroid Build Coastguard Worker;; clang -cc1 -O0 -debug-info-kind=limited -dwarf-version=4 -emit-llvm test.cpp 10*9880d681SAndroid Build Coastguard Worker;; Where test.cpp 11*9880d681SAndroid Build Coastguard Worker;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 12*9880d681SAndroid Build Coastguard Worker;;namespace N {} 13*9880d681SAndroid Build Coastguard Worker;; __attribute__((always_inline)) int bar() { 14*9880d681SAndroid Build Coastguard Worker;; { 15*9880d681SAndroid Build Coastguard Worker;; int y; 16*9880d681SAndroid Build Coastguard Worker;;#line 1 "test.h" 17*9880d681SAndroid Build Coastguard Worker;; using namespace N; 18*9880d681SAndroid Build Coastguard Worker;; while (y < 0) return 2; 19*9880d681SAndroid Build Coastguard Worker;; return 0; 20*9880d681SAndroid Build Coastguard Worker;; } 21*9880d681SAndroid Build Coastguard Worker;;} 22*9880d681SAndroid Build Coastguard Worker;;int foo() { 23*9880d681SAndroid Build Coastguard Worker;; return bar(); 24*9880d681SAndroid Build Coastguard Worker;;} 25*9880d681SAndroid Build Coastguard Worker;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Worker;; Concrete "bar" function 28*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram 29*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 30*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_abstract_origin {{.*}} {[[Offset_bar:0x[0-9abcdef]+]]} 31*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 32*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_lexical_block 33*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 34*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_variable 35*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 36*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_imported_module 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard Worker;; Abstract "bar" function 39*9880d681SAndroid Build Coastguard Worker; CHECK: [[Offset_bar]]: DW_TAG_subprogram 40*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 41*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_name {{.*}} "bar" 42*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 43*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_inline 44*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 45*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_lexical_block 46*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 47*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_variable 48*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 49*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_imported_module 50*9880d681SAndroid Build Coastguard Worker 51*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram 52*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 53*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_name {{.*}} "foo" 54*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{NULL}} 55*9880d681SAndroid Build Coastguard Worker 56*9880d681SAndroid Build Coastguard Worker;; Inlined "bar" function 57*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_inlined_subroutine 58*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: DW_AT_abstract_origin {{.*}} {[[Offset_bar]]} 59*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 60*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_lexical_block 61*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 62*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_variable 63*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: {{DW_TAG|NULL}} 64*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_imported_module 65*9880d681SAndroid Build Coastguard Worker 66*9880d681SAndroid Build Coastguard Worker 67*9880d681SAndroid Build Coastguard Worker; Function Attrs: alwaysinline nounwind 68*9880d681SAndroid Build Coastguard Workerdefine i32 @_Z3barv() #0 !dbg !4 { 69*9880d681SAndroid Build Coastguard Workerentry: 70*9880d681SAndroid Build Coastguard Worker %retval = alloca i32, align 4 71*9880d681SAndroid Build Coastguard Worker %y = alloca i32, align 4 72*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata i32* %y, metadata !18, metadata !19), !dbg !20 73*9880d681SAndroid Build Coastguard Worker br label %while.cond, !dbg !21 74*9880d681SAndroid Build Coastguard Worker 75*9880d681SAndroid Build Coastguard Workerwhile.cond: ; preds = %entry 76*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %y, align 4, !dbg !22 77*9880d681SAndroid Build Coastguard Worker %cmp = icmp slt i32 %0, 0, !dbg !22 78*9880d681SAndroid Build Coastguard Worker br i1 %cmp, label %while.body, label %while.end, !dbg !22 79*9880d681SAndroid Build Coastguard Worker 80*9880d681SAndroid Build Coastguard Workerwhile.body: ; preds = %while.cond 81*9880d681SAndroid Build Coastguard Worker store i32 2, i32* %retval, align 4, !dbg !24 82*9880d681SAndroid Build Coastguard Worker br label %return, !dbg !24 83*9880d681SAndroid Build Coastguard Worker 84*9880d681SAndroid Build Coastguard Workerwhile.end: ; preds = %while.cond 85*9880d681SAndroid Build Coastguard Worker store i32 0, i32* %retval, align 4, !dbg !26 86*9880d681SAndroid Build Coastguard Worker br label %return, !dbg !26 87*9880d681SAndroid Build Coastguard Worker 88*9880d681SAndroid Build Coastguard Workerreturn: ; preds = %while.end, %while.body 89*9880d681SAndroid Build Coastguard Worker %1 = load i32, i32* %retval, align 4, !dbg !27 90*9880d681SAndroid Build Coastguard Worker ret i32 %1, !dbg !27 91*9880d681SAndroid Build Coastguard Worker} 92*9880d681SAndroid Build Coastguard Worker 93*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone 94*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.declare(metadata, metadata, metadata) #1 95*9880d681SAndroid Build Coastguard Worker 96*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind 97*9880d681SAndroid Build Coastguard Workerdefine i32 @_Z3foov() #2 !dbg !8 { 98*9880d681SAndroid Build Coastguard Workerentry: 99*9880d681SAndroid Build Coastguard Worker %retval.i = alloca i32, align 4 100*9880d681SAndroid Build Coastguard Worker %y.i = alloca i32, align 4 101*9880d681SAndroid Build Coastguard Worker call void @llvm.dbg.declare(metadata i32* %y.i, metadata !18, metadata !19), !dbg !29 102*9880d681SAndroid Build Coastguard Worker %0 = load i32, i32* %y.i, align 4, !dbg !31 103*9880d681SAndroid Build Coastguard Worker %cmp.i = icmp slt i32 %0, 0, !dbg !31 104*9880d681SAndroid Build Coastguard Worker br i1 %cmp.i, label %while.body.i, label %while.end.i, !dbg !31 105*9880d681SAndroid Build Coastguard Worker 106*9880d681SAndroid Build Coastguard Workerwhile.body.i: ; preds = %entry 107*9880d681SAndroid Build Coastguard Worker store i32 2, i32* %retval.i, align 4, !dbg !32 108*9880d681SAndroid Build Coastguard Worker br label %_Z3barv.exit, !dbg !32 109*9880d681SAndroid Build Coastguard Worker 110*9880d681SAndroid Build Coastguard Workerwhile.end.i: ; preds = %entry 111*9880d681SAndroid Build Coastguard Worker store i32 0, i32* %retval.i, align 4, !dbg !33 112*9880d681SAndroid Build Coastguard Worker br label %_Z3barv.exit, !dbg !33 113*9880d681SAndroid Build Coastguard Worker 114*9880d681SAndroid Build Coastguard Worker_Z3barv.exit: ; preds = %while.end.i, %while.body.i 115*9880d681SAndroid Build Coastguard Worker %1 = load i32, i32* %retval.i, align 4, !dbg !34 116*9880d681SAndroid Build Coastguard Worker ret i32 %1, !dbg !35 117*9880d681SAndroid Build Coastguard Worker} 118*9880d681SAndroid Build Coastguard Worker 119*9880d681SAndroid Build Coastguard Workerattributes #0 = { alwaysinline nounwind } 120*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone } 121*9880d681SAndroid Build Coastguard Workerattributes #2 = { nounwind } 122*9880d681SAndroid Build Coastguard Worker 123*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 124*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!15, !16} 125*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!17} 126*9880d681SAndroid Build Coastguard Worker 127*9880d681SAndroid Build Coastguard Worker!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) 128*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "test.cpp", directory: "/") 129*9880d681SAndroid Build Coastguard Worker!2 = !{} 130*9880d681SAndroid Build Coastguard Worker!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, variables: !2) 131*9880d681SAndroid Build Coastguard Worker!5 = !DISubroutineType(types: !6) 132*9880d681SAndroid Build Coastguard Worker!6 = !{!7} 133*9880d681SAndroid Build Coastguard Worker!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 134*9880d681SAndroid Build Coastguard Worker!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, variables: !2) 135*9880d681SAndroid Build Coastguard Worker!9 = !DIFile(filename: "test.h", directory: "/") 136*9880d681SAndroid Build Coastguard Worker!10 = !{!11} 137*9880d681SAndroid Build Coastguard Worker!11 = !DIImportedEntity(tag: DW_TAG_imported_module, scope: !12, entity: !14, line: 1) 138*9880d681SAndroid Build Coastguard Worker!12 = !DILexicalBlockFile(scope: !13, file: !9, discriminator: 0) 139*9880d681SAndroid Build Coastguard Worker!13 = distinct !DILexicalBlock(scope: !4, file: !1, line: 3) 140*9880d681SAndroid Build Coastguard Worker!14 = !DINamespace(name: "N", scope: null, file: !1, line: 1) 141*9880d681SAndroid Build Coastguard Worker!15 = !{i32 2, !"Dwarf Version", i32 4} 142*9880d681SAndroid Build Coastguard Worker!16 = !{i32 2, !"Debug Info Version", i32 3} 143*9880d681SAndroid Build Coastguard Worker!17 = !{!"clang version 3.9.0 (trunk 264349)"} 144*9880d681SAndroid Build Coastguard Worker!18 = !DILocalVariable(name: "y", scope: !13, file: !1, line: 4, type: !7) 145*9880d681SAndroid Build Coastguard Worker!19 = !DIExpression() 146*9880d681SAndroid Build Coastguard Worker!20 = !DILocation(line: 4, scope: !13) 147*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 2, scope: !12) 148*9880d681SAndroid Build Coastguard Worker!22 = !DILocation(line: 2, scope: !23) 149*9880d681SAndroid Build Coastguard Worker!23 = !DILexicalBlockFile(scope: !12, file: !9, discriminator: 1) 150*9880d681SAndroid Build Coastguard Worker!24 = !DILocation(line: 2, scope: !25) 151*9880d681SAndroid Build Coastguard Worker!25 = !DILexicalBlockFile(scope: !12, file: !9, discriminator: 2) 152*9880d681SAndroid Build Coastguard Worker!26 = !DILocation(line: 3, scope: !12) 153*9880d681SAndroid Build Coastguard Worker!27 = !DILocation(line: 5, scope: !28) 154*9880d681SAndroid Build Coastguard Worker!28 = !DILexicalBlockFile(scope: !4, file: !9, discriminator: 0) 155*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 4, scope: !13, inlinedAt: !30) 156*9880d681SAndroid Build Coastguard Worker!30 = distinct !DILocation(line: 7, scope: !8) 157*9880d681SAndroid Build Coastguard Worker!31 = !DILocation(line: 2, scope: !23, inlinedAt: !30) 158*9880d681SAndroid Build Coastguard Worker!32 = !DILocation(line: 2, scope: !25, inlinedAt: !30) 159*9880d681SAndroid Build Coastguard Worker!33 = !DILocation(line: 3, scope: !12, inlinedAt: !30) 160*9880d681SAndroid Build Coastguard Worker!34 = !DILocation(line: 5, scope: !28, inlinedAt: !30) 161*9880d681SAndroid Build Coastguard Worker!35 = !DILocation(line: 7, scope: !8) 162