51 lines · plain
1# RUN: llc -run-pass wasm-debug-fixup %s -o - | FileCheck %s2 3# Test if '#DEBUG_VALUE' comments for target indices are printed correctly.4 5--- |6 target triple = "wasm32-unknown-unknown"7 8 define void @test_remove_dangling_reg_dbg_value() !dbg !5 {9 call void @llvm.dbg.value(metadata i32 0, metadata !9, metadata !DIExpression()), !dbg !1010 call void @llvm.dbg.value(metadata i32 0, metadata !11, metadata !DIExpression()), !dbg !1011 ret void12 }13 14 declare void @llvm.dbg.value(metadata, metadata, metadata)15 16 !llvm.dbg.cu = !{!0}17 !llvm.module.flags = !{!2, !3, !4}18 19 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, emissionKind: FullDebug)20 !1 = !DIFile(filename: "test.c", directory: "")21 !2 = !{i32 7, !"Dwarf Version", i32 5}22 !3 = !{i32 2, !"Debug Info Version", i32 3}23 !4 = !{i32 1, !"wchar_size", i32 4}24 !5 = distinct !DISubprogram(name: "test_dbg_value_comment", scope: !1, file: !1, line: 1, type: !6, scopeLine: 1, unit: !0)25 !6 = !DISubroutineType(types: !7)26 !7 = !{!8}27 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)28 !9 = !DILocalVariable(name: "var0", scope: !5, file: !1, line: 2, type: !8)29 !10 = !DILocation(line: 0, scope: !5)30 !11 = !DILocalVariable(name: "var1", scope: !5, file: !1, line: 2, type: !8)31...32 33---34# CHECK-LABEL: name: test_remove_dangling_reg_dbg_value35name: test_remove_dangling_reg_dbg_value36liveins:37 - { reg: '$arguments' }38body: |39 ; CHECK: bb.0:40 ; CHECK: DBG_VALUE $noreg, $noreg, !9, !DIExpression(), debug-location !1041 ; CHECK-NEXT: DBG_VALUE target-index(wasm-local) + 1, $noreg, !11, !DIExpression(), debug-location !1042 ; CHECK-NEXT: RETURN43 bb.0:44 liveins: $arguments45 ; This %3 is a danling register and will turn to $noreg46 DBG_VALUE %3:i32, $noreg, !9, !DIExpression(), debug-location !1047 ; This debug info will remain the same, because it's in a local48 DBG_VALUE target-index(wasm-local) + 1, $noreg, !11, !DIExpression(), debug-location !1049 RETURN implicit-def dead $arguments50...51