1; RUN: llc < %s | FileCheck %s 2 3; Input C code: 4 5; int i = input(); // Nested case 6; int j = input(); // Trivial def-use. 7; output(i, j); 8 9; The ll below generates 330 lines of .S, so relevant parts that the 10; WebAssemblyDebugFixup pass affects: 11 12; CHECK: call input 13; CHECK: .Ltmp0: 14; CHECK: call input 15; CHECK: .Ltmp1: 16; CHECK: call output 17; CHECK: .Ltmp2: 18 19; This defines variable "i" which is live on the stack between Ltmp0 and Ltmp2, 20; 2 = TI_OPERAND_STACK and 0 = stack offset. 21 22; CHECK: .section .debug_loc,"",@ 23; CHECK: .Ldebug_loc0: 24; CHECK: .int32 .Ltmp0-.Lfunc_begin0 25; CHECK: .int32 .Ltmp2-.Lfunc_begin0 26; CHECK: .int16 4 # Loc expr size 27; CHECK: .int8 237 # DW_OP_WASM_location 28; CHECK: .int8 2 # 2 29; CHECK: .int8 0 # 0 30; CHECK: .int8 159 # DW_OP_stack_value 31 32; This defines variable "j" which is live on the stack between Ltmp1 and Ltmp2, 33; 2 = TI_OPERAND_STACK and 1 = stack offset. 34 35; CHECK: .Ldebug_loc1: 36; CHECK: .int32 .Ltmp1-.Lfunc_begin0 37; CHECK: .int32 .Ltmp2-.Lfunc_begin0 38; CHECK: .int16 4 # Loc expr size 39; CHECK: .int8 237 # DW_OP_WASM_location 40; CHECK: .int8 2 # 2 41; CHECK: .int8 1 # 1 42; CHECK: .int8 159 # DW_OP_stack_value 43 44 45 46 47source_filename = "stackified.c" 48target triple = "wasm32-unknown-unknown" 49 50define void @foo() !dbg !12 { 51entry: 52 %call = call i32 @input(), !dbg !18 53 call void @llvm.dbg.value(metadata i32 %call, metadata !16, metadata !DIExpression()), !dbg !19 54 %call1 = call i32 @input(), !dbg !20 55 call void @llvm.dbg.value(metadata i32 %call1, metadata !17, metadata !DIExpression()), !dbg !19 56 call void @output(i32 %call, i32 %call1), !dbg !21 57 ret void, !dbg !22 58} 59 60declare i32 @input() 61 62declare !dbg !4 void @output(i32, i32) 63 64declare void @llvm.dbg.value(metadata, metadata, metadata) 65 66!llvm.dbg.cu = !{!0} 67!llvm.module.flags = !{!8, !9, !10} 68!llvm.ident = !{!11} 69 70!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0 (https://github.com/llvm/llvm-project.git ed7aaf832444411ce93aa0443425ce401f5c7a8e)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, nameTableKind: None) 71!1 = !DIFile(filename: "stackified.c", directory: "C:\\stuff\\llvm-project") 72!2 = !{} 73!3 = !{!4} 74!4 = !DISubprogram(name: "output", scope: !1, file: !1, line: 2, type: !5, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2) 75!5 = !DISubroutineType(types: !6) 76!6 = !{null, !7, !7} 77!7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 78!8 = !{i32 7, !"Dwarf Version", i32 4} 79!9 = !{i32 2, !"Debug Info Version", i32 3} 80!10 = !{i32 1, !"wchar_size", i32 4} 81!11 = !{!"clang version 11.0.0 (https://github.com/llvm/llvm-project.git ed7aaf832444411ce93aa0443425ce401f5c7a8e)"} 82!12 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !13, scopeLine: 3, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !15) 83!13 = !DISubroutineType(types: !14) 84!14 = !{null} 85!15 = !{!16, !17} 86!16 = !DILocalVariable(name: "i", scope: !12, file: !1, line: 4, type: !7) 87!17 = !DILocalVariable(name: "j", scope: !12, file: !1, line: 5, type: !7) 88!18 = !DILocation(line: 4, column: 11, scope: !12) 89!19 = !DILocation(line: 0, scope: !12) 90!20 = !DILocation(line: 5, column: 11, scope: !12) 91!21 = !DILocation(line: 6, column: 3, scope: !12) 92!22 = !DILocation(line: 7, column: 1, scope: !12) 93