xref: /llvm-project/llvm/test/DebugInfo/COFF/inlining-files.ll (revision 050bb26174cd9eb60c3c192476091494604f9a5d)
1; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 < %s -filetype=obj | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
2
3; This LL file was generated by running 'clang -O1 -g -gcodeview' on the
4; volatile int x;
5; static inline void file_change(void) {
6;   x++;
7; #include "t.inc"
8;   x++;
9; }
10; void f(void) {
11;   ++x;
12;   file_change();
13;   ++x;
14; }
15; t.inc contents:
16; ++x;
17; ++x;
18
19; OBJ:  Subsection [
20; OBJ:    SubSectionType: Symbols (0xF1)
21; OBJ:    {{.*}}Proc{{.*}}Sym {
22; OBJ:      DisplayName: f
23; OBJ:    }
24; OBJ:     InlineesSym {
25; OBJ-NEXT:  Kind: S_INLINEES (0x1168)
26; OBJ-NEXT:  Inlinees [
27; OBJ-NEXT:    FuncID: file_change (0x1002)
28; OBJ-NEXT:  ]
29; OBJ-NEXT:}
30; OBJ:    InlineSiteSym {
31; OBJ:      PtrParent: 0x0
32; OBJ:      PtrEnd: 0x0
33; OBJ:      Inlinee: file_change (0x1002)
34; OBJ:      BinaryAnnotations [
35; OBJ:        ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 1}
36; OBJ:        ChangeFile: D:\src\llvm\build\t.inc (0x8)
37; OBJ:        ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: -2}
38; OBJ:        ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 1}
39; OBJ:        ChangeFile: D:\src\llvm\build\t.cpp (0x0)
40; OBJ:        ChangeCodeOffsetAndLineOffset: {CodeOffset: 0x6, LineOffset: 3}
41; OBJ:        ChangeCodeLength: 0x6
42; OBJ:      ]
43; OBJ:    }
44; OBJ:    InlineSiteEnd {
45; OBJ:    }
46; OBJ:    ProcEnd
47; OBJ:  ]
48
49; ModuleID = 't.cpp'
50source_filename = "test/DebugInfo/COFF/inlining-files.ll"
51target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
52target triple = "x86_64-pc-windows-msvc18.0.0"
53
54@x = common global i32 0, align 4, !dbg !0
55
56; Function Attrs: norecurse nounwind uwtable
57define void @f() #0 !dbg !12 {
58entry:
59  %0 = load volatile i32, ptr @x, align 4, !dbg !15, !tbaa !16
60  %inc = add nsw i32 %0, 1, !dbg !15
61  store volatile i32 %inc, ptr @x, align 4, !dbg !15, !tbaa !16
62  %1 = load volatile i32, ptr @x, align 4, !dbg !20, !tbaa !16
63  %inc.i = add nsw i32 %1, 1, !dbg !20
64  store volatile i32 %inc.i, ptr @x, align 4, !dbg !20, !tbaa !16
65  %2 = load volatile i32, ptr @x, align 4, !dbg !23, !tbaa !16
66  %inc1.i = add nsw i32 %2, 1, !dbg !23
67  store volatile i32 %inc1.i, ptr @x, align 4, !dbg !23, !tbaa !16
68  %3 = load volatile i32, ptr @x, align 4, !dbg !26, !tbaa !16
69  %inc2.i = add nsw i32 %3, 1, !dbg !26
70  store volatile i32 %inc2.i, ptr @x, align 4, !dbg !26, !tbaa !16
71  %4 = load volatile i32, ptr @x, align 4, !dbg !27, !tbaa !16
72  %inc3.i = add nsw i32 %4, 1, !dbg !27
73  store volatile i32 %inc3.i, ptr @x, align 4, !dbg !27, !tbaa !16
74  %5 = load volatile i32, ptr @x, align 4, !dbg !29, !tbaa !16
75  %inc1 = add nsw i32 %5, 1, !dbg !29
76  store volatile i32 %inc1, ptr @x, align 4, !dbg !29, !tbaa !16
77  ret void, !dbg !30
78}
79
80attributes #0 = { norecurse nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
81
82!llvm.dbg.cu = !{!2}
83!llvm.module.flags = !{!8, !9, !10}
84!llvm.ident = !{!11}
85
86!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
87!1 = !DIGlobalVariable(name: "x", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
88!2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 3.9.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
89!3 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
90!4 = !{}
91!5 = !{!0}
92!6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
93!7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
94!8 = !{i32 2, !"CodeView", i32 1}
95!9 = !{i32 2, !"Debug Info Version", i32 3}
96!10 = !{i32 1, !"PIC Level", i32 2}
97!11 = !{!"clang version 3.9.0 "}
98!12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 7, type: !13, isLocal: false, isDefinition: true, scopeLine: 7, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !4)
99!13 = !DISubroutineType(types: !14)
100!14 = !{null}
101!15 = !DILocation(line: 8, column: 3, scope: !12)
102!16 = !{!17, !17, i64 0}
103!17 = !{!"int", !18, i64 0}
104!18 = !{!"omnipotent char", !19, i64 0}
105!19 = !{!"Simple C/C++ TBAA"}
106!20 = !DILocation(line: 3, column: 4, scope: !21, inlinedAt: !22)
107!21 = distinct !DISubprogram(name: "file_change", scope: !3, file: !3, line: 2, type: !13, isLocal: true, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !4)
108!22 = distinct !DILocation(line: 9, column: 3, scope: !12)
109!23 = !DILocation(line: 1, column: 1, scope: !24, inlinedAt: !22)
110!24 = !DILexicalBlockFile(scope: !21, file: !25, discriminator: 0)
111!25 = !DIFile(filename: "./t.inc", directory: "D:\5Csrc\5Cllvm\5Cbuild")
112!26 = !DILocation(line: 2, column: 1, scope: !24, inlinedAt: !22)
113!27 = !DILocation(line: 5, column: 4, scope: !28, inlinedAt: !22)
114!28 = !DILexicalBlockFile(scope: !21, file: !3, discriminator: 0)
115!29 = !DILocation(line: 10, column: 3, scope: !12)
116!30 = !DILocation(line: 11, column: 1, scope: !12)
117
118