1 ; RUN: llc < %s -mtriple=arm64-windows -filetype=obj | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
7 ; static inline int inlineinc(int a) {
15 ; int b = inlineinc(a);
24 ; OBJ: DefRangeRegisterRelSym {
25 ; OBJ: Kind: S_DEFRANGE_REGISTER_REL (0x1145)
26 ; OBJ: BaseRegister: ARM64_SP (0x51)
27 ; OBJ: HasSpilledUDTMember: No
28 ; OBJ: OffsetInParent: 0
29 ; OBJ: BasePointerOffset: 12
30 ; OBJ: LocalVariableAddrRange {
31 ; OBJ: OffsetStart: .text+0x14
32 ; OBJ: ISectStart: 0x0
38 source_filename = "test/DebugInfo/COFF/register-variables-arm64.ll"
39 target datalayout = "e-m:w-p:64:64-i32:32-i64:64-i128:128-n32:64-S128"
40 target triple = "arm64-unknown-windows-msvc19.16.27023"
42 @x = common dso_local global i32 0, align 4, !dbg !0
44 ; Function Attrs: noinline nounwind optnone uwtable
45 define dso_local void @f(i32 %p) #0 !dbg !12 {
47 %p.addr = alloca i32, align 4
48 %a = alloca i32, align 4
49 %b = alloca i32, align 4
50 %c = alloca i32, align 4
51 store i32 %p, i32* %p.addr, align 4
52 call void @llvm.dbg.declare(metadata i32* %p.addr, metadata !15, metadata !DIExpression()), !dbg !16
53 %0 = load i32, i32* %p.addr, align 4, !dbg !17
54 %tobool = icmp ne i32 %0, 0, !dbg !17
55 br i1 %tobool, label %if.then, label %if.else, !dbg !17
57 if.then: ; preds = %entry
58 call void @llvm.dbg.declare(metadata i32* %a, metadata !18, metadata !DIExpression()), !dbg !21
59 %call = call i32 @getint(), !dbg !21
60 store i32 %call, i32* %a, align 4, !dbg !21
61 call void @llvm.dbg.declare(metadata i32* %b, metadata !22, metadata !DIExpression()), !dbg !23
62 %1 = load i32, i32* %a, align 4, !dbg !23
63 %call1 = call i32 @inlineinc(i32 %1), !dbg !23
64 store i32 %call1, i32* %b, align 4, !dbg !23
65 %2 = load i32, i32* %b, align 4, !dbg !24
66 call void @putint(i32 %2), !dbg !24
67 br label %if.end, !dbg !25
69 if.else: ; preds = %entry
70 call void @llvm.dbg.declare(metadata i32* %c, metadata !26, metadata !DIExpression()), !dbg !28
71 %call2 = call i32 @getint(), !dbg !28
72 store i32 %call2, i32* %c, align 4, !dbg !28
73 %3 = load i32, i32* %c, align 4, !dbg !29
74 call void @putint(i32 %3), !dbg !29
75 br label %if.end, !dbg !30
77 if.end: ; preds = %if.else, %if.then
81 ; Function Attrs: nounwind readnone speculatable
82 declare void @llvm.dbg.declare(metadata, metadata, metadata) #1
84 declare dso_local i32 @getint() #2
86 ; Function Attrs: noinline nounwind optnone uwtable
87 define internal i32 @inlineinc(i32 %a) #0 !dbg !32 {
89 %a.addr = alloca i32, align 4
90 %b = alloca i32, align 4
91 store i32 %a, i32* %a.addr, align 4
92 call void @llvm.dbg.declare(metadata i32* %a.addr, metadata !35, metadata !DIExpression()), !dbg !36
93 call void @llvm.dbg.declare(metadata i32* %b, metadata !37, metadata !DIExpression()), !dbg !38
94 %0 = load i32, i32* %a.addr, align 4, !dbg !38
95 %add = add nsw i32 %0, 1, !dbg !38
96 store i32 %add, i32* %b, align 4, !dbg !38
97 %1 = load volatile i32, i32* @x, align 4, !dbg !39
98 %inc = add nsw i32 %1, 1, !dbg !39
99 store volatile i32 %inc, i32* @x, align 4, !dbg !39
100 %2 = load i32, i32* %b, align 4, !dbg !40
104 declare dso_local void @putint(i32) #2
107 !llvm.module.flags = !{!8, !9, !10}
109 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
110 !1 = distinct !DIGlobalVariable(name: "x", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
111 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 9.0.0 (trunk 361867) (llvm/trunk 361866)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None)
112 !3 = !DIFile(filename: "t.c", directory: "S:\5CLLVM\5Csvn\5Csbr\5Cbin", checksumkind: CSK_MD5, checksum: "734c448e95a6204a439a847ed063e5ce")
115 !6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
116 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
117 !8 = !{i32 2, !"CodeView", i32 1}
118 !9 = !{i32 2, !"Debug Info Version", i32 3}
119 !10 = !{i32 1, !"wchar_size", i32 2}
120 !11 = !{!"clang version 9.0.0 (trunk 361867) (llvm/trunk 361866)"}
121 !12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 9, type: !13, scopeLine: 9, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !2, retainedNodes: !4)
122 !13 = !DISubroutineType(types: !14)
124 !15 = !DILocalVariable(name: "p", arg: 1, scope: !12, file: !3, line: 9, type: !7)
125 !16 = !DILocation(line: 9, scope: !12)
126 !17 = !DILocation(line: 10, scope: !12)
127 !18 = !DILocalVariable(name: "a", scope: !19, file: !3, line: 11, type: !7)
128 !19 = distinct !DILexicalBlock(scope: !20, file: !3, line: 10)
129 !20 = distinct !DILexicalBlock(scope: !12, file: !3, line: 10)
130 !21 = !DILocation(line: 11, scope: !19)
131 !22 = !DILocalVariable(name: "b", scope: !19, file: !3, line: 12, type: !7)
132 !23 = !DILocation(line: 12, scope: !19)
133 !24 = !DILocation(line: 13, scope: !19)
134 !25 = !DILocation(line: 14, scope: !19)
135 !26 = !DILocalVariable(name: "c", scope: !27, file: !3, line: 15, type: !7)
136 !27 = distinct !DILexicalBlock(scope: !20, file: !3, line: 14)
137 !28 = !DILocation(line: 15, scope: !27)
138 !29 = !DILocation(line: 16, scope: !27)
139 !30 = !DILocation(line: 17, scope: !27)
140 !31 = !DILocation(line: 18, scope: !12)
141 !32 = distinct !DISubprogram(name: "inlineinc", scope: !3, file: !3, line: 4, type: !33, scopeLine: 4, flags: DIFlagPrototyped, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition, unit: !2, retainedNodes: !4)
142 !33 = !DISubroutineType(types: !34)
144 !35 = !DILocalVariable(name: "a", arg: 1, scope: !32, file: !3, line: 4, type: !7)
145 !36 = !DILocation(line: 4, scope: !32)
146 !37 = !DILocalVariable(name: "b", scope: !32, file: !3, line: 5, type: !7)
147 !38 = !DILocation(line: 5, scope: !32)
148 !39 = !DILocation(line: 6, scope: !32)
149 !40 = !DILocation(line: 7, scope: !32)