1 ; RUN: llc < %s -filetype=obj | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
8 ; static inline int inlineinc(int a) {
16 ; int b = inlineinc(a);
25 ; OBJ-NEXT: Kind: S_COMPILE3 (0x113C)
26 ; OBJ-NEXT: Language: C (0x0)
27 ; OBJ-NEXT: Flags [ (0x0)
29 ; OBJ-NEXT: Machine: ARMNT (0xF4)
32 ; OBJ-NEXT: Kind: S_LOCAL (0x113E)
33 ; OBJ-NEXT: Type: int (0x74)
34 ; OBJ-NEXT: Flags [ (0x1)
35 ; OBJ-NEXT: IsParameter (0x1)
37 ; OBJ-NEXT: VarName: p
39 ; OBJ-NEXT: DefRangeRegisterRelSym {
40 ; OBJ-NEXT: Kind: S_DEFRANGE_REGISTER_REL (0x1145)
41 ; OBJ-NEXT: BaseRegister: ARM_SP (0x17)
42 ; OBJ-NEXT: HasSpilledUDTMember: No
43 ; OBJ-NEXT: OffsetInParent: 0
44 ; OBJ-NEXT: BasePointerOffset: 12
45 ; OBJ-NEXT: LocalVariableAddrRange {
46 ; OBJ-NEXT: OffsetStart: .text+0x8
47 ; OBJ-NEXT: ISectStart: 0x0
48 ; OBJ-NEXT: Range: 0x1A
53 source_filename = "test.c"
54 target datalayout = "e-m:w-p:32:32-Fi8-i64:64-v128:64:128-a:0:32-n32-S64"
55 target triple = "thumbv7-pc-windows-msvc19.11.0"
57 @x = dso_local global i32 0, align 4, !dbg !0
59 ; Function Attrs: noinline nounwind optnone
60 define dso_local arm_aapcs_vfpcc void @f(i32 %p) !dbg !14 {
62 %p.addr = alloca i32, align 4
63 %a = alloca i32, align 4
64 %b = alloca i32, align 4
65 %c = alloca i32, align 4
66 store i32 %p, i32* %p.addr, align 4
67 call void @llvm.dbg.declare(metadata i32* %p.addr, metadata !17, metadata !DIExpression()), !dbg !18
68 %0 = load i32, i32* %p.addr, align 4, !dbg !19
69 %tobool = icmp ne i32 %0, 0, !dbg !19
70 br i1 %tobool, label %if.then, label %if.else, !dbg !19
72 if.then: ; preds = %entry
73 call void @llvm.dbg.declare(metadata i32* %a, metadata !20, metadata !DIExpression()), !dbg !23
74 %call = call arm_aapcs_vfpcc i32 @getint(), !dbg !23
75 store i32 %call, i32* %a, align 4, !dbg !23
76 call void @llvm.dbg.declare(metadata i32* %b, metadata !24, metadata !DIExpression()), !dbg !25
77 %1 = load i32, i32* %a, align 4, !dbg !25
78 %call1 = call arm_aapcs_vfpcc i32 @inlineinc(i32 %1), !dbg !25
79 store i32 %call1, i32* %b, align 4, !dbg !25
80 %2 = load i32, i32* %b, align 4, !dbg !26
81 call arm_aapcs_vfpcc void @putint(i32 %2), !dbg !26
82 br label %if.end, !dbg !27
84 if.else: ; preds = %entry
85 call void @llvm.dbg.declare(metadata i32* %c, metadata !28, metadata !DIExpression()), !dbg !30
86 %call2 = call arm_aapcs_vfpcc i32 @getint(), !dbg !30
87 store i32 %call2, i32* %c, align 4, !dbg !30
88 %3 = load i32, i32* %c, align 4, !dbg !31
89 call arm_aapcs_vfpcc void @putint(i32 %3), !dbg !31
90 br label %if.end, !dbg !32
92 if.end: ; preds = %if.else, %if.then
96 ; Function Attrs: nounwind readnone speculatable willreturn
97 declare void @llvm.dbg.declare(metadata, metadata, metadata)
99 declare dso_local arm_aapcs_vfpcc i32 @getint()
101 ; Function Attrs: noinline nounwind optnone
102 define internal arm_aapcs_vfpcc i32 @inlineinc(i32 %a) !dbg !34 {
104 %a.addr = alloca i32, align 4
105 %b = alloca i32, align 4
106 store i32 %a, i32* %a.addr, align 4
107 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !37, metadata !DIExpression()), !dbg !38
108 call void @llvm.dbg.declare(metadata i32* %b, metadata !39, metadata !DIExpression()), !dbg !40
109 %0 = load i32, i32* %a.addr, align 4, !dbg !40
110 %add = add nsw i32 %0, 1, !dbg !40
111 store i32 %add, i32* %b, align 4, !dbg !40
112 %1 = load volatile i32, i32* @x, align 4, !dbg !41
113 %inc = add nsw i32 %1, 1, !dbg !41
114 store volatile i32 %inc, i32* @x, align 4, !dbg !41
115 %2 = load i32, i32* %b, align 4, !dbg !42
119 declare dso_local arm_aapcs_vfpcc void @putint(i32)
122 !llvm.module.flags = !{!9, !10, !11, !12}
125 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
126 !1 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !6, line: 1, type: !7, isLocal: false, isDefinition: true)
127 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 12.0.0 (https://github.com/llvm/llvm-project.git fc031d29bea856f2b91a250fd81c5f9fb79dbe07)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
128 !3 = !DIFile(filename: "F:\\tmp\\test.c", directory: "F:\\tmp", checksumkind: CSK_MD5, checksum: "5fbd15e58dd6931fc3081de308d52889")
131 !6 = !DIFile(filename: "test.c", directory: "F:\\tmp", checksumkind: CSK_MD5, checksum: "5fbd15e58dd6931fc3081de308d52889")
132 !7 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !8)
133 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
134 !9 = !{i32 2, !"CodeView", i32 1}
135 !10 = !{i32 2, !"Debug Info Version", i32 3}
136 !11 = !{i32 1, !"wchar_size", i32 2}
137 !12 = !{i32 1, !"min_enum_size", i32 4}
138 !13 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git fc031d29bea856f2b91a250fd81c5f9fb79dbe07)"}
139 !14 = distinct !DISubprogram(name: "f", scope: !6, file: !6, line: 9, type: !15, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
140 !15 = !DISubroutineType(types: !16)
142 !17 = !DILocalVariable(name: "p", arg: 1, scope: !14, file: !6, line: 9, type: !8)
143 !18 = !DILocation(line: 9, scope: !14)
144 !19 = !DILocation(line: 10, scope: !14)
145 !20 = !DILocalVariable(name: "a", scope: !21, file: !6, line: 11, type: !8)
146 !21 = distinct !DILexicalBlock(scope: !22, file: !6, line: 10)
147 !22 = distinct !DILexicalBlock(scope: !14, file: !6, line: 10)
148 !23 = !DILocation(line: 11, scope: !21)
149 !24 = !DILocalVariable(name: "b", scope: !21, file: !6, line: 12, type: !8)
150 !25 = !DILocation(line: 12, scope: !21)
151 !26 = !DILocation(line: 13, scope: !21)
152 !27 = !DILocation(line: 14, scope: !21)
153 !28 = !DILocalVariable(name: "c", scope: !29, file: !6, line: 15, type: !8)
154 !29 = distinct !DILexicalBlock(scope: !22, file: !6, line: 14)
155 !30 = !DILocation(line: 15, scope: !29)
156 !31 = !DILocation(line: 16, scope: !29)
157 !32 = !DILocation(line: 17, scope: !29)
158 !33 = !DILocation(line: 18, scope: !14)
159 !34 = distinct !DISubprogram(name: "inlineinc", scope: !6, file: !6, line: 4, type: !35, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !2, retainedNodes: !4)
160 !35 = !DISubroutineType(types: !36)
162 !37 = !DILocalVariable(name: "a", arg: 1, scope: !34, file: !6, line: 4, type: !8)
163 !38 = !DILocation(line: 4, scope: !34)
164 !39 = !DILocalVariable(name: "b", scope: !34, file: !6, line: 5, type: !8)
165 !40 = !DILocation(line: 5, scope: !34)
166 !41 = !DILocation(line: 6, scope: !34)
167 !42 = !DILocation(line: 7, scope: !34)