blob: bfaf8a420a161c53298d660631676a5d87bfc2f1 [file] [log] [blame]
Matthias Braun538859c2016-07-16 02:24:59 +00001# RUN: llc -march=x86-64 -run-pass none -o - %s | FileCheck %s
Alex Lorenzdf9e3c62015-08-19 00:13:25 +00002# This test ensures that the MIR parser parses the stack object's debug info
3# correctly.
4--- |
5 declare void @llvm.dbg.declare(metadata, metadata, metadata) #0
6
7 define void @foo() #1 {
8 entry:
9 %x.i = alloca i8, align 1
10 %y.i = alloca [256 x i8], align 16
11 %0 = bitcast [256 x i8]* %y.i to i8*
12 br label %for.body
13
14 for.body:
15 %1 = bitcast [256 x i8]* %y.i to i8*
16 call void @llvm.lifetime.end(i64 -1, i8* %1) #3
17 call void @llvm.lifetime.start(i64 -1, i8* %0) #3
Reid Kleckner6d353342017-08-23 20:31:27 +000018 call void @llvm.dbg.declare(metadata i8* %0, metadata !4, metadata !DIExpression()) #3, !dbg !7
Alex Lorenzdf9e3c62015-08-19 00:13:25 +000019 br label %for.body
20 }
21
22 declare void @llvm.lifetime.start(i64, i8* nocapture) #2
23
24 declare void @llvm.lifetime.end(i64, i8* nocapture) #2
25
26 attributes #0 = { nounwind readnone }
27 attributes #1 = { nounwind ssp uwtable }
28 attributes #2 = { nounwind argmemonly }
29 attributes #3 = { nounwind }
30
31 !llvm.dbg.cu = !{!0}
32 !llvm.module.flags = !{!3}
33
Adrian Prantl75819ae2016-04-15 15:57:41 +000034 !0 = distinct !DICompileUnit(language: DW_LANG_C89, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)
Alex Lorenzdf9e3c62015-08-19 00:13:25 +000035 !1 = !DIFile(filename: "t.c", directory: "")
36 !2 = !{}
37 !3 = !{i32 1, !"Debug Info Version", i32 3}
Reid Kleckner6d353342017-08-23 20:31:27 +000038 !4 = !DILocalVariable(name: "x", scope: !5, file: !1, line: 16, type: !8)
Adrian Prantl75819ae2016-04-15 15:57:41 +000039 !5 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false, unit: !0)
Alex Lorenzdf9e3c62015-08-19 00:13:25 +000040 !6 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
Reid Kleckner6d353342017-08-23 20:31:27 +000041 !7 = !DILocation(line: 0, scope: !5)
42 !8 = !DICompositeType(tag: DW_TAG_array_type, baseType: !6, size: 2048, align: 8, elements: !9)
43 !9 = !{!10}
44 !10 = !DISubrange(count: 256)
Alex Lorenzdf9e3c62015-08-19 00:13:25 +000045...
46---
47name: foo
Alex Lorenzdf9e3c62015-08-19 00:13:25 +000048tracksRegLiveness: true
49frameInfo:
50 maxAlignment: 16
51# CHECK-LABEL: foo
52# CHECK: stack:
Vivek Pandya56d87ef2017-06-06 08:16:19 +000053# CHECK: - { id: 0, name: y.i, type: default, offset: 0, size: 256, alignment: 16,
Matthias Braun5c3e8a42017-09-28 18:52:14 +000054# CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true,
Francis Visoiu Mistrih57fcd342018-04-25 18:58:06 +000055# CHECK-NEXT: debug-info-variable: '!4', debug-info-expression: '!DIExpression()',
56# CHECK-NEXT: debug-info-location: '!10' }
Alex Lorenzdf9e3c62015-08-19 00:13:25 +000057stack:
Francis Visoiu Mistrih57fcd342018-04-25 18:58:06 +000058 - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16,
59 debug-info-variable: '!4', debug-info-expression: '!DIExpression()',
60 debug-info-location: '!7' }
Alex Lorenzdf9e3c62015-08-19 00:13:25 +000061body: |
62 bb.0.entry:
63 successors: %bb.1.for.body
64 bb.1.for.body:
65 successors: %bb.1.for.body
66
Reid Kleckner6d353342017-08-23 20:31:27 +000067 DBG_VALUE %stack.0.y.i, 0, !4, !DIExpression(), debug-location !7
Alex Lorenzdf9e3c62015-08-19 00:13:25 +000068 JMP_1 %bb.1.for.body
69...