1 # RUN: llc -run-pass wasm-debug-fixup %s -o - | FileCheck %s
3 # Test if '#DEBUG_VALUE' comments for target indices are printed correctly.
6 target triple = "wasm32-unknown-unknown"
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 !10
10 call void @llvm.dbg.value(metadata i32 0, metadata !11, metadata !DIExpression()), !dbg !10
14 declare void @llvm.dbg.value(metadata, metadata, metadata)
17 !llvm.module.flags = !{!2, !3, !4}
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)
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)
34 # CHECK-LABEL: name: test_remove_dangling_reg_dbg_value
35 name: test_remove_dangling_reg_dbg_value
37 - { reg: '$arguments' }
40 ; CHECK: DBG_VALUE $noreg, $noreg, !9, !DIExpression(), debug-location !10
41 ; CHECK-NEXT: DBG_VALUE target-index(wasm-local) + 1, $noreg, !11, !DIExpression(), debug-location !10
45 ; This %3 is a danling register and will turn to $noreg
46 DBG_VALUE %3:i32, $noreg, !9, !DIExpression(), debug-location !10
47 ; This debug info will remain the same, because it's in a local
48 DBG_VALUE target-index(wasm-local) + 1, $noreg, !11, !DIExpression(), debug-location !10
49 RETURN implicit-def dead $arguments