1 # RUN: llc -march=x86-64 -start-after machine-sink -stop-after machine-sink -o /dev/null %s | FileCheck %s 2 # 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 18 call void @llvm.dbg.declare(metadata i8* %0, metadata !4, metadata !7) #3, !dbg !8 19 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 34 !0 = distinct !DICompileUnit(language: DW_LANG_C89, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: 0, enums: !2, retainedTypes: !2) 35 !1 = !DIFile(filename: "t.c", directory: "") 36 !2 = !{} 37 !3 = !{i32 1, !"Debug Info Version", i32 3} 38 !4 = !DILocalVariable(name: "x", scope: !5, file: !1, line: 16, type: !6) 39 !5 = distinct !DISubprogram(scope: null, isLocal: false, isDefinition: true, isOptimized: false) 40 !6 = !DIBasicType(name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char) 41 !7 = !DIExpression() 42 !8 = !DILocation(line: 0, scope: !5) 43 ... 44 --- 45 name: foo 46 isSSA: true 47 tracksRegLiveness: true 48 frameInfo: 49 maxAlignment: 16 50 # CHECK-LABEL: foo 51 # CHECK: stack: 52 # CHECK: - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4', 53 # CHECK-NEXT: di-expression: '!7', di-location: '!8' } 54 stack: 55 - { id: 0, name: y.i, offset: 0, size: 256, alignment: 16, di-variable: '!4', 56 di-expression: '!7', di-location: '!8' } 57 body: | 58 bb.0.entry: 59 successors: %bb.1.for.body 60 bb.1.for.body: 61 successors: %bb.1.for.body 62 63 DBG_VALUE %stack.0.y.i, 0, !4, !7, debug-location !8 64 JMP_1 %bb.1.for.body 65 ... 66