1; REQUIRES: asserts 2; RUN: llc -global-isel -mtriple=aarch64 %s -stop-after=irtranslator -o - | FileCheck %s 3; RUN: llc -mtriple=aarch64 -global-isel --global-isel-abort=0 %s -o /dev/null 4; RUN: llc -mtriple=aarch64 -global-isel --global-isel-abort=0 %s -o /dev/null -debug 5; 6; RUN: llc -global-isel -mtriple=aarch64 %s -stop-after=irtranslator -o - --try-experimental-debuginfo-iterators | FileCheck %s 7; RUN: llc -mtriple=aarch64 -global-isel --global-isel-abort=0 %s -o /dev/null --try-experimental-debuginfo-iterators 8; RUN: llc -mtriple=aarch64 -global-isel --global-isel-abort=0 %s -o /dev/null -debug --try-experimental-debuginfo-iterators 9 10; CHECK-LABEL: name: debug_declare 11; CHECK: stack: 12; CHECK: - { id: {{.*}}, name: in.addr, type: default, offset: 0, size: {{.*}}, alignment: {{.*}}, 13; CHECK-NEXT: callee-saved-register: '', callee-saved-restored: true, 14; CHECK-NEXT: debug-info-variable: '!11', debug-info-expression: '!DIExpression()', 15define void @debug_declare(i32 %in) #0 !dbg !7 { 16entry: 17 %in.addr = alloca i32, align 4 18 store i32 %in, ptr %in.addr, align 4 19 call void @llvm.dbg.declare(metadata ptr %in.addr, metadata !11, metadata !DIExpression()), !dbg !12 20 ret void, !dbg !12 21} 22 23; CHECK-LABEL: name: debug_declare_vla 24; CHECK: DBG_VALUE %{{[0-9]+}}(p0), 0, !14, !DIExpression(), debug-location !15 25define void @debug_declare_vla(i32 %in) #0 !dbg !13 { 26entry: 27 %vla.addr = alloca i32, i32 %in 28 call void @llvm.dbg.declare(metadata ptr %vla.addr, metadata !14, metadata !DIExpression()), !dbg !15 29 ret void, !dbg !15 30} 31 32@gv = global i32 zeroinitializer 33 34; CHECK-LABEL: name: debug_value 35; CHECK: stack: 36; CHECK: - { id: {{.*}}, name: addr 37; CHECK: [[IN:%[0-9]+]]:_(s32) = COPY $w0 38define void @debug_value(i32 %in) #0 !dbg !16 { 39; CHECK: G_FRAME_INDEX %[[stack_slot:.*]] 40 %addr = alloca i32 41; CHECK: DBG_VALUE [[IN]](s32), $noreg, !17, !DIExpression(), debug-location !18 42 call void @llvm.dbg.value(metadata i32 %in, i64 0, metadata !17, metadata !DIExpression()), !dbg !18 43 store i32 %in, ptr %addr 44; CHECK: DBG_VALUE %[[stack_slot]], 0, !17, !DIExpression(), debug-location !18 45 call void @llvm.dbg.value(metadata ptr %addr, i64 0, metadata !17, metadata !DIExpression(DW_OP_deref)), !dbg !18 46; CHECK: DBG_VALUE 123, 0, !17, !DIExpression(), debug-location !18 47 call void @llvm.dbg.value(metadata i32 123, i64 0, metadata !17, metadata !DIExpression()), !dbg !18 48; CHECK: DBG_VALUE float 1.000000e+00, 0, !17, !DIExpression(), debug-location !18 49 call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !17, metadata !DIExpression()), !dbg !18 50; CHECK: DBG_VALUE 0, 0, !17, !DIExpression(), debug-location !18 51 call void @llvm.dbg.value(metadata ptr null, i64 0, metadata !17, metadata !DIExpression()), !dbg !18 52; CHECK: DBG_VALUE $noreg, 0, !17, !DIExpression(), debug-location !18 53 call void @llvm.dbg.value(metadata ptr @gv, i64 0, metadata !17, metadata !DIExpression()), !dbg !18 54; CHECK: DBG_VALUE 42, 0, !17, !DIExpression(), debug-location !18 55 call void @llvm.dbg.value(metadata ptr inttoptr (i64 42 to ptr), i64 0, metadata !17, metadata !DIExpression()), !dbg !18 56 ret void 57} 58 59; Function Attrs: nounwind readnone 60declare void @llvm.dbg.declare(metadata, metadata, metadata) 61declare void @llvm.dbg.value(metadata, i64, metadata, metadata) 62 63!llvm.dbg.cu = !{!0} 64!llvm.module.flags = !{!3, !4, !5} 65!llvm.ident = !{!6} 66 67!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 4.0.0 (trunk 289075) (llvm/trunk 289080)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 68!1 = !DIFile(filename: "tmp.c", directory: "/Users/tim/llvm/build") 69!2 = !{} 70!3 = !{i32 2, !"Dwarf Version", i32 4} 71!4 = !{i32 2, !"Debug Info Version", i32 3} 72!5 = !{i32 1, !"PIC Level", i32 2} 73!6 = !{!"clang version 4.0.0 (trunk 289075) (llvm/trunk 289080)"} 74!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 75!8 = !DISubroutineType(types: !9) 76!9 = !{null, !10} 77!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 78!11 = !DILocalVariable(name: "in", arg: 1, scope: !7, file: !1, line: 1, type: !10) 79!12 = !DILocation(line: 1, column: 14, scope: !7) 80!13 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 81!14 = !DILocalVariable(name: "in", arg: 1, scope: !13, file: !1, line: 1, type: !10) 82!15 = !DILocation(line: 1, column: 14, scope: !13) 83!16 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2) 84!17 = !DILocalVariable(name: "in", arg: 1, scope: !16, file: !1, line: 1, type: !10) 85!18 = !DILocation(line: 1, column: 14, scope: !16) 86