1 ; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck %s
4 ; inline __attribute__((always_inline)) int f1() {
10 ; inline __attribute__((always_inline)) int f2() {
22 ; Ensure that lexical_blocks within inlined_subroutines are preserved/emitted.
23 ; CHECK: DW_TAG_inlined_subroutine
26 ; CHECK: DW_TAG_lexical_block
29 ; CHECK: DW_TAG_variable
30 ; Ensure that file changes don't interfere with creating inlined subroutines.
31 ; (see the line directive inside 'f2' in thesource)
32 ; CHECK: DW_TAG_inlined_subroutine
33 ; CHECK: DW_TAG_variable
35 ; CHECK: DW_AT_abstract_origin
37 ; Function Attrs: uwtable
38 define i32 @main() #0 !dbg !4 {
40 %retval.i2 = alloca i32, align 4
41 %b.i3 = alloca i8, align 1
42 %retval.i = alloca i32, align 4
43 %b.i = alloca i8, align 1
44 call void @llvm.dbg.declare(metadata ptr %b.i, metadata !16, metadata !DIExpression()), !dbg !19
45 %call.i = call zeroext i1 @_Z1fv(), !dbg !19
46 %frombool.i = zext i1 %call.i to i8, !dbg !19
47 store i8 %frombool.i, ptr %b.i, align 1, !dbg !19
48 %0 = load i8, ptr %b.i, align 1, !dbg !19
49 %tobool.i = trunc i8 %0 to i1, !dbg !19
50 br i1 %tobool.i, label %if.then.i, label %if.end.i, !dbg !19
52 if.then.i: ; preds = %entry
53 store i32 1, ptr %retval.i, !dbg !21
54 br label %_Z2f1v.exit, !dbg !21
56 if.end.i: ; preds = %entry
57 store i32 2, ptr %retval.i, !dbg !22
58 br label %_Z2f1v.exit, !dbg !22
60 _Z2f1v.exit: ; preds = %if.then.i, %if.end.i
61 %1 = load i32, ptr %retval.i, !dbg !23
62 call void @llvm.dbg.declare(metadata ptr %b.i3, metadata !24, metadata !DIExpression()), !dbg !27
63 %call.i4 = call zeroext i1 @_Z1fv(), !dbg !27
64 %frombool.i5 = zext i1 %call.i4 to i8, !dbg !27
65 store i8 %frombool.i5, ptr %b.i3, align 1, !dbg !27
66 %2 = load i8, ptr %b.i3, align 1, !dbg !27
67 %tobool.i6 = trunc i8 %2 to i1, !dbg !27
68 br i1 %tobool.i6, label %if.then.i7, label %if.end.i8, !dbg !27
70 if.then.i7: ; preds = %_Z2f1v.exit
71 store i32 3, ptr %retval.i2, !dbg !29
72 br label %_Z2f2v.exit, !dbg !29
74 if.end.i8: ; preds = %_Z2f1v.exit
75 store i32 4, ptr %retval.i2, !dbg !30
76 br label %_Z2f2v.exit, !dbg !30
78 _Z2f2v.exit: ; preds = %if.then.i7, %if.end.i8
79 %3 = load i32, ptr %retval.i2, !dbg !31
83 ; Function Attrs: nounwind readnone
84 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
86 declare zeroext i1 @_Z1fv() #2
88 attributes #0 = { uwtable "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
89 attributes #1 = { nounwind readnone }
90 attributes #2 = { "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
93 !llvm.module.flags = !{!13, !14}
96 !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)
97 !1 = !DIFile(filename: "inline-scopes.cpp", directory: "/tmp/dbginfo")
99 !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)
100 !5 = !DIFile(filename: "y.cc", directory: "/tmp/dbginfo")
101 !6 = !DIFile(filename: "y.cc", directory: "/tmp/dbginfo")
102 !7 = !DISubroutineType(types: !8)
104 !9 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
105 !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)
106 !11 = !DIFile(filename: "inline-scopes.cpp", directory: "/tmp/dbginfo")
107 !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)
108 !13 = !{i32 2, !"Dwarf Version", i32 4}
109 !14 = !{i32 1, !"Debug Info Version", i32 3}
110 !15 = !{!"clang version 3.5.0 "}
111 !16 = !DILocalVariable(name: "b", line: 3, scope: !17, file: !11, type: !18)
112 !17 = distinct !DILexicalBlock(line: 3, column: 0, file: !1, scope: !12)
113 !18 = !DIBasicType(tag: DW_TAG_base_type, name: "bool", size: 8, align: 8, encoding: DW_ATE_boolean)
114 !19 = !DILocation(line: 3, scope: !17, inlinedAt: !20)
115 !20 = !DILocation(line: 8, scope: !4)
116 !21 = !DILocation(line: 4, scope: !17, inlinedAt: !20)
117 !22 = !DILocation(line: 5, scope: !12, inlinedAt: !20)
118 !23 = !DILocation(line: 6, scope: !12, inlinedAt: !20)
119 !24 = !DILocalVariable(name: "b", line: 2, scope: !25, file: !6, type: !18)
120 !25 = distinct !DILexicalBlock(line: 2, column: 0, file: !5, scope: !26)
121 !26 = !DILexicalBlockFile(discriminator: 0, file: !5, scope: !10)
122 !27 = !DILocation(line: 2, scope: !25, inlinedAt: !28)
123 !28 = !DILocation(line: 9, scope: !4)
124 !29 = !DILocation(line: 3, scope: !25, inlinedAt: !28)
125 !30 = !DILocation(line: 4, scope: !26, inlinedAt: !28)
126 !31 = !DILocation(line: 5, scope: !26, inlinedAt: !28)
127 !32 = !DILocation(line: 10, scope: !4)