1 # RUN: llc %s -o - -experimental-debug-variable-locations \
2 # RUN: -run-pass=greedy,virtregrewriter | FileCheck %s
4 # This test is for stack spill folding -- the SETCC near the start of the MIR
5 # below show be morphed into an SETCCm by the register allocator, making it
6 # store to %stack.0. We should track this fact in the substitution table, by
7 # adding a substitution to the memory-operand operand number.
9 # This is a single operand spill -- there's a separate test for tied def ones.
11 # Ideally this test would be shorter; however, it needs to be sufficiently
12 # complex to force the register allocator to spill something, so there's a
15 # CHECK: debugValueSubstitutions:
16 # CHECK-NEXT: - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 1000000, subreg: 0 }
18 # CHECK: SETCCm %stack.0, {{.*}} debug-instr-number 2
20 target triple = "x86_64--"
22 define void @beans() !dbg !7 {
27 !llvm.module.flags = !{!3, !4, !5}
30 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
31 !1 = !DIFile(filename: "test.c", directory: ".")
33 !3 = !{i32 7, !"Dwarf Version", i32 4}
34 !4 = !{i32 2, !"Debug Info Version", i32 3}
35 !5 = !{i32 1, !"wchar_size", i32 4}
37 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
38 !8 = !DISubroutineType(types: !9)
40 !10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
41 !11 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed)
42 !12 = !DILocalVariable(name: "bar", arg: 1, scope: !7, file: !1, line: 3, type: !11)
43 !13 = !DILocation(line: 0, scope: !7)
44 !14 = !DILocalVariable(name: "baz", arg: 2, scope: !7, file: !1, line: 3, type: !11)
45 !15 = distinct !DILexicalBlock(scope: !7, file: !1, line: 8, column: 7)
51 tracksRegLiveness: True
57 CMP32ri8 %7, 4, implicit-def $eflags
58 %0:gr8 = SETCCr 4, implicit $eflags, debug-instr-number 1
60 ; clobber all registers to force a spill/reload
61 INLINEASM &nop, 1 /* sideeffect attdialect */, 12 /* clobber */, implicit-def dead early-clobber $rax, 12 /* clobber */, implicit-def dead early-clobber $rbx, 12 /* clobber */, implicit-def dead early-clobber $rcx, 12 /* clobber */, implicit-def dead early-clobber $rdx, 12 /* clobber */, implicit-def dead early-clobber $rsi, 12 /* clobber */, implicit-def dead early-clobber $rdi, 12 /* clobber */, implicit-def dead early-clobber $rbp, 12 /* clobber */, implicit-def dead early-clobber $r8, 12 /* clobber */, implicit-def dead early-clobber $r9, 12 /* clobber */, implicit-def dead early-clobber $r10, 12 /* clobber */, implicit-def dead early-clobber $r11, 12 /* clobber */, implicit-def dead early-clobber $r12, 12 /* clobber */, implicit-def dead early-clobber $r13, 12 /* clobber */, implicit-def dead early-clobber $r14, 12 /* clobber */, implicit-def dead early-clobber $r15