1 ; RUN: llc < %s | FileCheck %s --check-prefix=ASM
2 ; 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);
26 ; ASM: # %bb.0: # %entry
27 ; ASM: #DEBUG_VALUE: f:p <- $ecx
30 ; ASM: movl %ecx, %esi
31 ; ASM: [[p_ecx_esi:\.Ltmp.*]]:
32 ; ASM: #DEBUG_VALUE: f:p <- $esi
34 ; ASM: [[after_getint:\.Ltmp.*]]:
35 ; ASM: #DEBUG_VALUE: a <- $eax
36 ; ASM: #DEBUG_VALUE: inlineinc:a <- $eax
37 ; ASM: #DEBUG_VALUE: c <- $eax
38 ; ASM: testl %esi, %esi
40 ; ASM: [[after_je:\.Ltmp.*]]:
41 ; ASM: # %bb.1: # %if.then
42 ; ASM-DAG: #DEBUG_VALUE: inlineinc:a <- $eax
43 ; ASM-DAG: #DEBUG_VALUE: a <- $eax
44 ; ASM-DAG: #DEBUG_VALUE: f:p <- $esi
46 ; ASM: [[after_inc_eax:\.Ltmp.*]]:
47 ; ASM: #DEBUG_VALUE: inlineinc:b <- $eax
48 ; ASM: #DEBUG_VALUE: b <- $eax
49 ; ASM: addl $1, x(%rip)
50 ; ASM: [[after_if:\.Ltmp.*]]:
51 ; ASM: .LBB0_2: # %if.else
52 ; ASM: #DEBUG_VALUE: f:p <- $esi
53 ; ASM: movl %eax, %ecx
56 ; ASM: [[func_end:\.Ltmp.*]]:
57 ; ASM: jmp putint # TAILCALL
59 ; ASM: .short 4414 # Record kind: S_LOCAL
61 ; ASM: .cv_def_range .Lfunc_begin0 [[p_ecx_esi]], "A\021\022\000\000\000"
62 ; ASM: .cv_def_range [[p_ecx_esi]] [[func_end]], "A\021\027\000\000\000"
63 ; ASM: .short 4414 # Record kind: S_LOCAL
65 ; ASM: .cv_def_range [[after_getint]] [[after_je]], "A\021\021\000\000\000"
66 ; ASM: .short 4414 # Record kind: S_LOCAL
68 ; ASM: .cv_def_range [[after_getint]] [[after_inc_eax]], "A\021\021\000\000\000"
69 ; ASM: .short 4414 # Record kind: S_LOCAL
71 ; ASM: .cv_def_range [[after_inc_eax]] [[after_if]], "A\021\021\000\000\000"
73 ; ASM: .short 4429 # Record kind: S_INLINESITE
74 ; ASM: .short 4414 # Record kind: S_LOCAL
76 ; ASM: .cv_def_range [[after_getint]] [[after_inc_eax]], "A\021\021\000\000\000"
77 ; ASM: .short 4414 # Record kind: S_LOCAL
79 ; ASM: .cv_def_range [[after_inc_eax]] [[after_if]], "A\021\021\000\000\000"
80 ; ASM: .short 4430 # Record kind: S_INLINESITE_END
83 ; OBJ: SubSectionType: Symbols (0xF1)
84 ; OBJ: {{.*}}Proc{{.*}}Sym {
88 ; OBJ: Type: int (0x74)
90 ; OBJ: IsParameter (0x1)
94 ; OBJ: DefRangeRegisterSym {
95 ; OBJ: Register: ECX (0x12)
96 ; OBJ: LocalVariableAddrRange {
97 ; OBJ: OffsetStart: .text+0x0
98 ; OBJ: ISectStart: 0x0
102 ; OBJ: DefRangeRegisterSym {
103 ; OBJ: Register: ESI (0x17)
104 ; OBJ: LocalVariableAddrRange {
105 ; OBJ: OffsetStart: .text+0x7
106 ; OBJ: ISectStart: 0x0
111 ; OBJ: Type: int (0x74)
116 ; OBJ: DefRangeRegisterSym {
117 ; OBJ: Register: EAX (0x11)
118 ; OBJ: LocalVariableAddrRange {
119 ; OBJ: OffsetStart: .text+0xC
120 ; OBJ: ISectStart: 0x0
125 ; OBJ: Type: int (0x74)
130 ; OBJ: DefRangeRegisterSym {
131 ; OBJ: Register: EAX (0x11)
132 ; OBJ: LocalVariableAddrRange {
133 ; OBJ: OffsetStart: .text+0xC
134 ; OBJ: ISectStart: 0x0
139 ; OBJ: Type: int (0x74)
144 ; OBJ: DefRangeRegisterSym {
145 ; OBJ: Register: EAX (0x11)
146 ; OBJ: MayHaveNoName: 0
147 ; OBJ: OffsetStart: .text+0x13
148 ; OBJ: ISectStart: 0x0
152 ; OBJ: InlineSiteSym {
153 ; OBJ: PtrParent: 0x0
155 ; OBJ: Inlinee: inlineinc (0x1002)
158 ; OBJ: Type: int (0x74)
160 ; OBJ: IsParameter (0x1)
164 ; OBJ: DefRangeRegisterSym {
165 ; OBJ: Register: EAX (0x11)
166 ; OBJ: LocalVariableAddrRange {
167 ; OBJ: OffsetStart: .text+0xC
168 ; OBJ: ISectStart: 0x0
173 ; OBJ: Type: int (0x74)
178 ; OBJ: DefRangeRegisterSym {
179 ; OBJ: Register: EAX (0x11)
180 ; OBJ: LocalVariableAddrRange {
181 ; OBJ: OffsetStart: .text+0x13
182 ; OBJ: ISectStart: 0x0
186 ; OBJ: InlineSiteEnd {
192 source_filename = "test/DebugInfo/COFF/register-variables.ll"
193 target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
194 target triple = "x86_64-pc-windows-msvc18.0.0"
196 @x = internal global i32 0, align 4, !dbg !0
198 ; Function Attrs: nounwind uwtable
199 define void @f(i32 %p) #0 !dbg !12 {
201 tail call void @llvm.dbg.value(metadata i32 %p, metadata !16, metadata !23), !dbg !24
202 %tobool = icmp eq i32 %p, 0, !dbg !25
203 %call2 = tail call i32 @getint() #3, !dbg !26
204 br i1 %tobool, label %if.else, label %if.then, !dbg !27
206 if.then: ; preds = %entry
207 tail call void @llvm.dbg.value(metadata i32 %call2, metadata !17, metadata !23), !dbg !28
208 tail call void @llvm.dbg.value(metadata i32 %call2, metadata !29, metadata !23), !dbg !35
209 %add.i = add nsw i32 %call2, 1, !dbg !37
210 tail call void @llvm.dbg.value(metadata i32 %add.i, metadata !34, metadata !23), !dbg !38
211 %0 = load volatile i32, i32* @x, align 4, !dbg !39, !tbaa !40
212 %inc.i = add nsw i32 %0, 1, !dbg !39
213 store volatile i32 %inc.i, i32* @x, align 4, !dbg !39, !tbaa !40
214 tail call void @llvm.dbg.value(metadata i32 %add.i, metadata !20, metadata !23), !dbg !44
215 tail call void @putint(i32 %add.i) #3, !dbg !45
216 br label %if.end, !dbg !46
218 if.else: ; preds = %entry
219 tail call void @llvm.dbg.value(metadata i32 %call2, metadata !21, metadata !23), !dbg !47
220 tail call void @putint(i32 %call2) #3, !dbg !48
223 if.end: ; preds = %if.else, %if.then
227 declare i32 @getint() #1
229 declare void @putint(i32) #1
231 ; Function Attrs: nounwind readnone
232 declare void @llvm.dbg.value(metadata, metadata, metadata) #2
234 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
235 attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
236 attributes #2 = { nounwind readnone }
237 attributes #3 = { nounwind }
240 !llvm.module.flags = !{!8, !9, !10}
243 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
244 !1 = !DIGlobalVariable(name: "x", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
245 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5)
246 !3 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
249 !6 = !DIDerivedType(tag: DW_TAG_volatile_type, baseType: !7)
250 !7 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
251 !8 = !{i32 2, !"CodeView", i32 1}
252 !9 = !{i32 2, !"Debug Info Version", i32 3}
253 !10 = !{i32 1, !"PIC Level", i32 2}
254 !11 = !{!"clang version 3.9.0 (trunk 260617) (llvm/trunk 260619)"}
255 !12 = distinct !DISubprogram(name: "f", scope: !3, file: !3, line: 9, type: !13, isLocal: false, isDefinition: true, scopeLine: 9, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !15)
256 !13 = !DISubroutineType(types: !14)
258 !15 = !{!16, !17, !20, !21}
259 !16 = !DILocalVariable(name: "p", arg: 1, scope: !12, file: !3, line: 9, type: !7)
260 !17 = !DILocalVariable(name: "a", scope: !18, file: !3, line: 11, type: !7)
261 !18 = distinct !DILexicalBlock(scope: !19, file: !3, line: 10, column: 10)
262 !19 = distinct !DILexicalBlock(scope: !12, file: !3, line: 10, column: 7)
263 !20 = !DILocalVariable(name: "b", scope: !18, file: !3, line: 12, type: !7)
264 !21 = !DILocalVariable(name: "c", scope: !22, file: !3, line: 15, type: !7)
265 !22 = distinct !DILexicalBlock(scope: !19, file: !3, line: 14, column: 10)
266 !23 = !DIExpression()
267 !24 = !DILocation(line: 9, column: 12, scope: !12)
268 !25 = !DILocation(line: 10, column: 7, scope: !19)
269 !26 = !DILocation(line: 15, column: 13, scope: !22)
270 !27 = !DILocation(line: 10, column: 7, scope: !12)
271 !28 = !DILocation(line: 11, column: 9, scope: !18)
272 !29 = !DILocalVariable(name: "a", arg: 1, scope: !30, file: !3, line: 4, type: !7)
273 !30 = distinct !DISubprogram(name: "inlineinc", scope: !3, file: !3, line: 4, type: !31, isLocal: true, isDefinition: true, scopeLine: 4, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !33)
274 !31 = !DISubroutineType(types: !32)
277 !34 = !DILocalVariable(name: "b", scope: !30, file: !3, line: 5, type: !7)
278 !35 = !DILocation(line: 4, column: 33, scope: !30, inlinedAt: !36)
279 !36 = distinct !DILocation(line: 12, column: 13, scope: !18)
280 !37 = !DILocation(line: 5, column: 13, scope: !30, inlinedAt: !36)
281 !38 = !DILocation(line: 5, column: 7, scope: !30, inlinedAt: !36)
282 !39 = !DILocation(line: 6, column: 3, scope: !30, inlinedAt: !36)
283 !40 = !{!41, !41, i64 0}
284 !41 = !{!"int", !42, i64 0}
285 !42 = !{!"omnipotent char", !43, i64 0}
286 !43 = !{!"Simple C/C++ TBAA"}
287 !44 = !DILocation(line: 12, column: 9, scope: !18)
288 !45 = !DILocation(line: 13, column: 5, scope: !18)
289 !46 = !DILocation(line: 14, column: 3, scope: !18)
290 !47 = !DILocation(line: 15, column: 9, scope: !22)
291 !48 = !DILocation(line: 16, column: 5, scope: !22)
292 !49 = !DILocation(line: 18, column: 1, scope: !12)