1 # After adding new debug instruction for labels, it is possible to have
2 # debug instructions before DBG_VALUE. When querying DBG_VALUE's slot
3 # index using previous instruction and the previous instruction is debug
4 # instruction, it will trigger an assertion as using debug instruction
5 # to get slot index. This test is to emulate the case when DBG_VALUE's
6 # previous instruction is DBG_LABEL in LiveDebugVariables pass.
8 # RUN: llc -run-pass=livedebugvars -run-pass=virtregrewriter -o - %s | FileCheck %s
11 target triple = "x86_64-unknown-linux-gnu"
13 define i32 @foo(i32 %a, i32 %b) !dbg !4 {
19 !llvm.module.flags = !{!3}
21 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
22 !1 = !DIFile(filename: "debug-var-slot.c", directory: "./")
24 !3 = !{i32 2, !"Debug Info Version", i32 3}
25 !4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, isOptimized: true, unit: !0, retainedNodes: !2)
26 !5 = !DISubroutineType(types: !6)
28 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
29 !8 = !DILabel(scope: !4, name: "top", file: !1, line: 4)
30 !9 = !DILocation(line: 4, column: 1, scope: !4)
31 !10 = !DILocalVariable(name: "local_var", scope: !4, file: !1, line: 7, type: !7)
32 !11 = !DILocation(line: 7, column: 1, scope: !4)
33 !12 = !DILocation(line: 8, column: 3, scope: !4)
34 !13 = !DILocalVariable(name: "local_var2", scope: !4, file: !1, line: 7, type: !7)
39 tracksRegLiveness: true
43 DBG_VALUE $esi, $noreg, !13, !DIExpression(), debug-location !11
44 DBG_LABEL !8, debug-location !9
45 DBG_VALUE $edi, $noreg, !10, !DIExpression(), debug-location !11
46 RET 0, undef $eax, debug-location !12
49 # CHECK-LABEL: name: foo
51 # CHECK-DAG: DBG_LABEL
52 # CHECK-DAG: DBG_VALUE $esi
53 # CHECK-DAG: DBG_VALUE $edi