1 ; REQUIRES: object-emission
3 ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s
6 ; inline __attribute__((always_inline)) int f1() {
12 ; inline __attribute__((always_inline)) int f2() {
24 ; Ensure that lexical_blocks within inlined_subroutines are preserved/emitted.
25 ; CHECK: DW_TAG_inlined_subroutine
28 ; CHECK: DW_TAG_lexical_block
31 ; CHECK: DW_TAG_variable
32 ; Ensure that file changes don't interfere with creating inlined subroutines.
33 ; (see the line directive inside 'f2' in thesource)
34 ; CHECK: DW_TAG_inlined_subroutine
35 ; CHECK: DW_TAG_variable
37 ; CHECK: DW_AT_abstract_origin
39 ; Function Attrs: uwtable
40 define i32 @main() #0 !dbg !4 {
42 %retval.i2 = alloca i32, align 4
43 %b.i3 = alloca i8, align 1
44 %retval.i = alloca i32, align 4
45 %b.i = alloca i8, align 1
46 call void @llvm.dbg.declare(metadata i8* %b.i, metadata !16, metadata !DIExpression()), !dbg !19
47 %call.i = call zeroext i1 @_Z1fv(), !dbg !19
48 %frombool.i = zext i1 %call.i to i8, !dbg !19
49 store i8 %frombool.i, i8* %b.i, align 1, !dbg !19
50 %0 = load i8, i8* %b.i, align 1, !dbg !19
51 %tobool.i = trunc i8 %0 to i1, !dbg !19
52 br i1 %tobool.i, label %if.then.i, label %if.end.i, !dbg !19
54 if.then.i: ; preds = %entry
55 store i32 1, i32* %retval.i, !dbg !21
56 br label %_Z2f1v.exit, !dbg !21
58 if.end.i: ; preds = %entry
59 store i32 2, i32* %retval.i, !dbg !22
60 br label %_Z2f1v.exit, !dbg !22
62 _Z2f1v.exit: ; preds = %if.then.i, %if.end.i
63 %1 = load i32, i32* %retval.i, !dbg !23
64 call void @llvm.dbg.declare(metadata i8* %b.i3, metadata !24, metadata !DIExpression()), !dbg !27
65 %call.i4 = call zeroext i1 @_Z1fv(), !dbg !27
66 %frombool.i5 = zext i1 %call.i4 to i8, !dbg !27
67 store i8 %frombool.i5, i8* %b.i3, align 1, !dbg !27
68 %2 = load i8, i8* %b.i3, align 1, !dbg !27
69 %tobool.i6 = trunc i8 %2 to i1, !dbg !27
70 br i1 %tobool.i6, label %if.then.i7, label %if.end.i8, !dbg !27
72 if.then.i7: ; preds = %_Z2f1v.exit
73 store i32 3, i32* %retval.i2, !dbg !29
74 br label %_Z2f2v.exit, !dbg !29
76 if.end.i8: ; preds = %_Z2f1v.exit
77 store i32 4, i32* %retval.i2, !dbg !30
78 br label %_Z2f2v.exit, !dbg !30
80 _Z2f2v.exit: ; preds = %if.then.i7, %if.end.i8
81 %3 = load i32, i32* %retval.i2, !dbg !31
85 ; Function Attrs: nounwind readnone
86 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
88 declare zeroext i1 @_Z1fv() #2
90 attributes #0 = { 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" }
91 attributes #1 = { nounwind readnone }
92 attributes #2 = { "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" }
95 !llvm.module.flags = !{!13, !14}
98 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.5.0 ", isOptimized: false, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
99 !1 = !DIFile(filename: "inline-scopes.cpp", directory: "/tmp/dbginfo")
101 !4 = distinct !DISubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !5, scope: !6, type: !7, retainedNodes: !2)
102 !5 = !DIFile(filename: "y.cc", directory: "/tmp/dbginfo")
103 !6 = !DIFile(filename: "y.cc", directory: "/tmp/dbginfo")
104 !7 = !DISubroutineType(types: !8)
106 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
107 !10 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", line: 8, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 8, file: !1, scope: !11, type: !7, retainedNodes: !2)
108 !11 = !DIFile(filename: "inline-scopes.cpp", directory: "/tmp/dbginfo")
109 !12 = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1v", line: 2, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 2, file: !1, scope: !11, type: !7, retainedNodes: !2)
110 !13 = !{i32 2, !"Dwarf Version", i32 4}
111 !14 = !{i32 1, !"Debug Info Version", i32 3}
112 !15 = !{!"clang version 3.5.0 "}
113 !16 = !DILocalVariable(name: "b", line: 3, scope: !17, file: !11, type: !18)
114 !17 = distinct !DILexicalBlock(line: 3, column: 0, file: !1, scope: !12)
115 !18 = !DIBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)
116 !19 = !DILocation(line: 3, scope: !17, inlinedAt: !20)
117 !20 = !DILocation(line: 8, scope: !4)
118 !21 = !DILocation(line: 4, scope: !17, inlinedAt: !20)
119 !22 = !DILocation(line: 5, scope: !12, inlinedAt: !20)
120 !23 = !DILocation(line: 6, scope: !12, inlinedAt: !20)
121 !24 = !DILocalVariable(name: "b", line: 2, scope: !25, file: !6, type: !18)
122 !25 = distinct !DILexicalBlock(line: 2, column: 0, file: !5, scope: !26)
123 !26 = !DILexicalBlockFile(discriminator: 0, file: !5, scope: !10)
124 !27 = !DILocation(line: 2, scope: !25, inlinedAt: !28)
125 !28 = !DILocation(line: 9, scope: !4)
126 !29 = !DILocation(line: 3, scope: !25, inlinedAt: !28)
127 !30 = !DILocation(line: 4, scope: !26, inlinedAt: !28)
128 !31 = !DILocation(line: 5, scope: !26, inlinedAt: !28)
129 !32 = !DILocation(line: 10, scope: !4)