xref: /llvm-project/llvm/test/DebugInfo/COFF/inlining-padding.ll (revision 050bb26174cd9eb60c3c192476091494604f9a5d)
1; RUN: llc < %s -filetype=obj -o - | llvm-readobj --codeview --codeview-subsection-bytes - | FileCheck %s
2; RUN: llc < %s -o - | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj --codeview --codeview-subsection-bytes - | FileCheck %s
3
4; Check how we pad out the LF_FUNC_ID records. The 00F3F2F1 bytes in LeafData are
5; what's interesting here.
6
7; CHECK:  FuncId (0x1002) {
8; CHECK:    TypeLeafKind: LF_FUNC_ID (0x1601)
9; CHECK:    Name: a
10; CHECK:    LeafData (
11; CHECK:      0000: {{.*}} 6100F2F1           |........a...|
12; CHECK:    )
13; CHECK:  }
14; CHECK:  FuncId (0x1003) {
15; CHECK:    TypeLeafKind: LF_FUNC_ID (0x1601)
16; CHECK:    Name: ab
17; CHECK:    LeafData (
18; CHECK:      0000: {{.*}} 616200F1           |........ab..|
19; CHECK:    )
20; CHECK:  }
21; CHECK:  FuncId (0x1004) {
22; CHECK:    TypeLeafKind: LF_FUNC_ID (0x1601)
23; CHECK:    Name: abc
24; CHECK:    LeafData (
25; CHECK:      0000: {{.*}} 61626300           |........abc.|
26; CHECK:    )
27; CHECK:  }
28; CHECK:  FuncId (0x1005) {
29; CHECK:    TypeLeafKind: LF_FUNC_ID (0x1601)
30; CHECK:    Name: abcd
31; CHECK:    LeafData (
32; CHECK:      0000: {{.*}} 61626364 00F3F2F1  |........abcd....|
33; CHECK:    )
34; CHECK:  }
35
36; CHECK:      InlineesSym {
37; CHECK-NEXT:   Kind: S_INLINEES (0x1168)
38; CHECK-NEXT:   Inlinees [
39; CHECK-NEXT:     FuncID: a (0x1002)
40; CHECK-NEXT:     FuncID: ab (0x1003)
41; CHECK-NEXT:     FuncID: abc (0x1004)
42; CHECK-NEXT:     FuncID: abcd (0x1005)
43; CHECK-NEXT:   ]
44
45; C++ source used to generate the IR:
46;
47; extern volatile int x;
48; static void a() { x++; }
49; static void ab() { x++; }
50; static void abc() { x++; }
51; static void abcd() { x++; }
52; int main() {
53;   a();
54;   ab();
55;   abc();
56;   abcd();
57; }
58
59; ModuleID = 't.cpp'
60source_filename = "t.cpp"
61target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
62target triple = "x86_64-pc-windows-msvc"
63
64@x = external global i32, align 4
65
66; Function Attrs: norecurse nounwind
67define i32 @main() #0 !dbg !6 {
68entry:
69  store volatile i32 0, ptr @x, align 4, !dbg !11, !tbaa !16
70  store volatile i32 0, ptr @x, align 4, !dbg !20, !tbaa !16
71  store volatile i32 0, ptr @x, align 4, !dbg !23, !tbaa !16
72  store volatile i32 0, ptr @x, align 4, !dbg !26, !tbaa !16
73  ret i32 0, !dbg !29
74}
75
76attributes #0 = { norecurse nounwind "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-features"="+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
77
78!llvm.dbg.cu = !{!0}
79!llvm.module.flags = !{!3, !4}
80!llvm.ident = !{!5}
81
82!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 270461) (llvm/trunk 270469)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
83!1 = !DIFile(filename: "<stdin>", directory: "D:\5Csrc\5Cllvm\5Cbuild")
84!2 = !{}
85!3 = !{i32 2, !"CodeView", i32 1}
86!4 = !{i32 2, !"Debug Info Version", i32 3}
87!5 = !{!"clang version 3.9.0 (trunk 270461) (llvm/trunk 270469)"}
88!6 = distinct !DISubprogram(name: "main", scope: !7, file: !7, line: 6, type: !8, isLocal: false, isDefinition: true, scopeLine: 6, isOptimized: true, unit: !0, retainedNodes: !2)
89!7 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
90!8 = !DISubroutineType(types: !9)
91!9 = !{!10}
92!10 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
93!11 = !DILocation(line: 2, scope: !12, inlinedAt: !15)
94!12 = distinct !DISubprogram(name: "a", scope: !7, file: !7, line: 2, type: !13, isLocal: true, isDefinition: true, scopeLine: 2, isOptimized: true, unit: !0, retainedNodes: !2)
95!13 = !DISubroutineType(types: !14)
96!14 = !{null}
97!15 = distinct !DILocation(line: 7, scope: !6)
98!16 = !{!17, !17, i64 0}
99!17 = !{!"int", !18, i64 0}
100!18 = !{!"omnipotent char", !19, i64 0}
101!19 = !{!"Simple C/C++ TBAA"}
102!20 = !DILocation(line: 3, scope: !21, inlinedAt: !22)
103!21 = distinct !DISubprogram(name: "ab", scope: !7, file: !7, line: 3, type: !13, isLocal: true, isDefinition: true, scopeLine: 3, isOptimized: true, unit: !0, retainedNodes: !2)
104!22 = distinct !DILocation(line: 8, scope: !6)
105!23 = !DILocation(line: 4, scope: !24, inlinedAt: !25)
106!24 = distinct !DISubprogram(name: "abc", scope: !7, file: !7, line: 4, type: !13, isLocal: true, isDefinition: true, scopeLine: 4, isOptimized: true, unit: !0, retainedNodes: !2)
107!25 = distinct !DILocation(line: 9, scope: !6)
108!26 = !DILocation(line: 5, scope: !27, inlinedAt: !28)
109!27 = distinct !DISubprogram(name: "abcd", scope: !7, file: !7, line: 5, type: !13, isLocal: true, isDefinition: true, scopeLine: 5, isOptimized: true, unit: !0, retainedNodes: !2)
110!28 = distinct !DILocation(line: 10, scope: !6)
111!29 = !DILocation(line: 11, scope: !6)
112