1; RUN: llc -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s 2 3; ModuleID = 'debugtest.c' 4source_filename = "debugtest.c" 5target triple = "wasm32" 6; Function Attrs: noinline nounwind optnone 7define hidden i32 @foo(i32 %arg) #0 !dbg !7 { 8entry: 9 %arg.addr = alloca i32, align 4 10 %a = alloca i32, align 4 11 %b = alloca i32, align 4 12 store i32 %arg, ptr %arg.addr, align 4 13 call void @llvm.dbg.declare(metadata ptr %arg.addr, metadata !11, metadata !DIExpression()), !dbg !12 14 call void @llvm.dbg.declare(metadata ptr %a, metadata !13, metadata !DIExpression()), !dbg !14 15 store i32 1, ptr %a, align 4, !dbg !14 16 call void @llvm.dbg.declare(metadata ptr %b, metadata !15, metadata !DIExpression()), !dbg !17 17 store i32 2, ptr %b, align 4, !dbg !17 18 %0 = load i32, ptr %b, align 4, !dbg !18 19 store i32 %0, ptr %arg.addr, align 4, !dbg !19 20 %1 = load i32, ptr %arg.addr, align 4, !dbg !20 21 %2 = load i32, ptr %a, align 4, !dbg !21 22 %add = add nsw i32 %1, %2, !dbg !22 23 ret i32 %add, !dbg !23 24} 25; Function Attrs: nounwind readnone speculatable willreturn 26declare void @llvm.dbg.declare(metadata, metadata, metadata) #1 27 28attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "frame-pointer"="none" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="generic" "unsafe-fp-math"="false" "use-soft-float"="false" } 29attributes #1 = { nounwind readnone speculatable willreturn } 30attributes #2 = { nounwind } 31 32!llvm.dbg.cu = !{!0} 33!llvm.module.flags = !{!3, !4, !5} 34!llvm.ident = !{!6} 35 36!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 10.0.0 (https://github.com/llvm/llvm-project.git 6b38826e3a5f402498f0ea721b8c90d727f36205)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None) 37!1 = !DIFile(filename: "debugtest.c", directory: "/s/llvm-upstream") 38!2 = !{} 39!3 = !{i32 7, !"Dwarf Version", i32 4} 40!4 = !{i32 2, !"Debug Info Version", i32 3} 41!5 = !{i32 1, !"wchar_size", i32 4} 42!6 = !{!"clang version 10.0.0 (https://github.com/llvm/llvm-project.git 6b38826e3a5f402498f0ea721b8c90d727f36205)"} 43!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 44!8 = !DISubroutineType(types: !9) 45!9 = !{!10, !10} 46!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 47!11 = !DILocalVariable(name: "arg", arg: 1, scope: !7, file: !1, line: 1, type: !10) 48!12 = !DILocation(line: 1, column: 14, scope: !7) 49!13 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 2, type: !10) 50!14 = !DILocation(line: 2, column: 7, scope: !7) 51!15 = !DILocalVariable(name: "b", scope: !16, file: !1, line: 4, type: !10) 52!16 = distinct !DILexicalBlock(scope: !7, file: !1, line: 3, column: 3) 53!17 = !DILocation(line: 4, column: 9, scope: !16) 54!18 = !DILocation(line: 5, column: 11, scope: !16) 55!19 = !DILocation(line: 5, column: 9, scope: !16) 56!20 = !DILocation(line: 7, column: 10, scope: !7) 57!21 = !DILocation(line: 7, column: 16, scope: !7) 58!22 = !DILocation(line: 7, column: 14, scope: !7) 59!23 = !DILocation(line: 7, column: 3, scope: !7) 60!24 = distinct !DISubprogram(name: "bar", scope: !1, file: !1, line: 10, type: !8, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 61!25 = !DILocalVariable(name: "arg", arg: 1, scope: !24, file: !1, line: 10, type: !10) 62!26 = !DILocation(line: 10, column: 14, scope: !24) 63!27 = !DILocation(line: 11, column: 10, scope: !24) 64!28 = !DILocation(line: 11, column: 3, scope: !24) 65!29 = !DILocalVariable(name: "__vla_expr0", scope: !24, type: !30, flags: DIFlagArtificial) 66!30 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned) 67!31 = !DILocation(line: 0, scope: !24) 68!32 = !DILocalVariable(name: "aa", scope: !24, file: !1, line: 11, type: !33) 69!33 = !DICompositeType(tag: DW_TAG_array_type, baseType: !10, elements: !34) 70!34 = !{!35} 71!35 = !DISubrange(count: !29) 72!36 = !DILocation(line: 11, column: 7, scope: !24) 73!37 = !DILocalVariable(name: "cc", scope: !24, file: !1, line: 13, type: !38) 74!38 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 75!39 = !DILocation(line: 13, column: 8, scope: !24) 76!40 = !DILocation(line: 15, column: 1, scope: !24) 77 78; CHECK-LABEL: DW_TAG_compile_unit 79; CHECK-LABEL: DW_TAG_subprogram 80; CHECK-NEXT: DW_AT_low_pc (0x00000002) 81; CHECK-NEXT: DW_AT_high_pc (0x00000039) 82; CHECK-NEXT: DW_AT_frame_base (DW_OP_WASM_location 0x0 0x1, DW_OP_stack_value) 83; CHECK-NEXT: DW_AT_name ("foo") 84; CHECK-NEXT: DW_AT_decl_file ("/s/llvm-upstream{{(/|\\)}}debugtest.c") 85; CHECK-NEXT: DW_AT_decl_line (1) 86; CHECK-NEXT: DW_AT_prototyped (true) 87; CHECK-NEXT: DW_AT_type (0x00000073 "int") 88; CHECK-NEXT: DW_AT_external (true) 89; CHECK-LABEL: DW_TAG_formal_parameter 90; CHECK-NEXT: DW_AT_location (DW_OP_fbreg +12) 91; CHECK-NEXT: DW_AT_name ("arg") 92; CHECK-NEXT: DW_AT_decl_file ("/s/llvm-upstream{{(/|\\)}}debugtest.c") 93; CHECK-NEXT: DW_AT_decl_line (1) 94; CHECK-NEXT: DW_AT_type (0x00000073 "int") 95 96; CHECK-LABEL: DW_TAG_variable 97; CHECK-NEXT: DW_AT_location (DW_OP_fbreg +8) 98; CHECK-NEXT: DW_AT_name ("a") 99; CHECK-NEXT: DW_AT_decl_file ("/s/llvm-upstream{{(/|\\)}}debugtest.c") 100; CHECK-NEXT: DW_AT_decl_line (2) 101; CHECK-NEXT: DW_AT_type (0x00000073 "int") 102 103; CHECK-LABEL: DW_TAG_lexical_block 104; CHECK-NEXT: DW_AT_low_pc (0x0000001c) 105; CHECK-NEXT: DW_AT_high_pc (0x0000002d) 106 107; CHECK-LABEL: DW_TAG_variable 108; CHECK-NEXT: DW_AT_location (DW_OP_fbreg +4) 109; CHECK-NEXT: DW_AT_name ("b") 110; CHECK-NEXT: DW_AT_decl_file ("/s/llvm-upstream{{(/|\\)}}debugtest.c") 111; CHECK-NEXT: DW_AT_decl_line (4) 112; CHECK-NEXT: DW_AT_type (0x00000073 "int") 113