1# RUN: llc %s -o - -experimental-debug-variable-locations \ 2# RUN: -run-pass=greedy,virtregrewriter | FileCheck %s 3# 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. 8# 9# This is a single operand spill -- there's a separate test for tied def ones. 10# 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 13# limit. 14# 15# CHECK: debugValueSubstitutions: 16# CHECK-NEXT: - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 1000000, subreg: 0 } 17# CHECK-LABEL: bb.0: 18# CHECK: SETCCm %stack.0, {{.*}} debug-instr-number 2 19--- | 20 target triple = "x86_64--" 21 22 define void @beans() !dbg !7 { 23 ret void 24 } 25 26 !llvm.dbg.cu = !{!0} 27 !llvm.module.flags = !{!3, !4, !5} 28 !llvm.ident = !{!6} 29 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: ".") 32 !2 = !{} 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} 36 !6 = !{!"clang"} 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) 39 !9 = !{!10, !11, !11} 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) 46 47 48... 49--- 50name: beans 51tracksRegLiveness: True 52debugInstrRef: true 53body: | 54 bb.0: 55 liveins: $edi 56 %7:gr32 = COPY $edi 57 CMP32ri8 %7, 4, implicit-def $eflags 58 %0:gr8 = SETCCr 4, implicit $eflags, debug-instr-number 1 59 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 62 63 $al = COPY %0 64 RET 0, $al 65... 66