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