blob: 2c01180092bd857ba8a44a34d1ed60a5155d6f26 [file] [log] [blame]
# RUN: llc %s -o - -experimental-debug-variable-locations \
# RUN: -start-before=x86-flags-copy-lowering -stop-after=virtregrewriter \
# RUN: -mtriple x86_64-unknown-unknown \
# RUN: | FileCheck %s
#
# This test is for stack spill folding -- the SETCC near the start of the MIR
# below show be morphed into an SETCCm by the register allocator, making it
# store to %stack.0. We should track this fact in the substitution table, by
# adding a substitution to the memory-operand operand number.
#
# This is a single operand spill -- there's a separate test for tied def ones.
#
# Ideally this test would be shorter; however, it needs to be sufficiently
# complex to force the register allocator to spill something, so there's a
# limit.
#
# CHECK: debugValueSubstitutions:
# CHECK-NEXT: - { srcinst: 1, srcop: 0, dstinst: 2, dstop: 1000000, subreg: 0 }
# CHECK-LABEL: bb.0:
# CHECK: SETCCm %stack.0, {{.*}} debug-instr-number 2
--- |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
define internal fastcc void @beans(i32 %Kind) unnamed_addr align 2 !dbg !7 {
ret void
}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4, !5}
!llvm.ident = !{!6}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
!1 = !DIFile(filename: "test.c", directory: ".")
!2 = !{}
!3 = !{i32 7, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = !{i32 1, !"wchar_size", i32 4}
!6 = !{!"clang"}
!7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !8, scopeLine: 3, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
!8 = !DISubroutineType(types: !9)
!9 = !{!10, !11, !11}
!10 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!11 = !DIBasicType(name: "short", size: 16, encoding: DW_ATE_signed)
!12 = !DILocalVariable(name: "bar", arg: 1, scope: !7, file: !1, line: 3, type: !11)
!13 = !DILocation(line: 0, scope: !7)
!14 = !DILocalVariable(name: "baz", arg: 2, scope: !7, file: !1, line: 3, type: !11)
!15 = distinct !DILexicalBlock(scope: !7, file: !1, line: 8, column: 7)
...
---
name: beans
alignment: 16
tracksRegLiveness: true
registers:
- { id: 0, class: gr8 }
- { id: 1, class: gr8 }
- { id: 2, class: gr8 }
- { id: 3, class: gr32 }
- { id: 4, class: gr64 }
- { id: 5, class: gr8 }
- { id: 6, class: gr32 }
- { id: 7, class: gr32 }
- { id: 8, class: gr32 }
- { id: 9, class: gr32 }
- { id: 10, class: gr32 }
- { id: 11, class: gr64 }
- { id: 12, class: gr64 }
- { id: 13, class: gr32 }
- { id: 14, class: gr8 }
- { id: 15, class: gr8 }
- { id: 16, class: gr32 }
- { id: 17, class: gr64 }
- { id: 18, class: gr8 }
- { id: 19, class: gr8 }
- { id: 20, class: gr32 }
- { id: 21, class: gr64 }
- { id: 22, class: gr32 }
- { id: 23, class: gr32 }
- { id: 24, class: gr64 }
- { id: 25, class: gr32 }
- { id: 26, class: gr64 }
- { id: 27, class: gr8 }
- { id: 28, class: gr64_nosp }
- { id: 29, class: gr32 }
- { id: 30, class: gr8 }
- { id: 31, class: gr8 }
- { id: 32, class: gr64 }
- { id: 33, class: gr8 }
- { id: 34, class: gr64 }
- { id: 35, class: gr64 }
- { id: 36, class: gr8 }
- { id: 37, class: gr64 }
- { id: 38, class: gr8 }
- { id: 39, class: gr32 }
- { id: 40, class: gr32 }
- { id: 41, class: gr8 }
- { id: 42, class: gr8 }
- { id: 43, class: gr8 }
liveins:
- { reg: '$edi', virtual-reg: '%7' }
frameInfo:
maxAlignment: 1
hasCalls: true
machineFunctionInfo: {}
jumpTable:
kind: block-address
entries:
- id: 0
blocks: [ '%bb.11', '%bb.7', '%bb.11', '%bb.7', '%bb.12',
'%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7',
'%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.13',
'%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7',
'%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7',
'%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7',
'%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7', '%bb.7',
'%bb.8' ]
body: |
bb.0:
successors: %bb.2(0x20000000), %bb.14(0x60000000)
liveins: $edi
%7:gr32 = COPY $edi
CMP32ri8 %7, 4, implicit-def $eflags
%0:gr8 = SETCCr 4, implicit $eflags, debug-instr-number 1
CMP32ri8 %7, 2, implicit-def $eflags
%1:gr8 = SETCCr 4, implicit $eflags
CMP32ri8 %7, 1, implicit-def $eflags
%2:gr8 = SETCCr 4, implicit $eflags
%11:gr64 = IMPLICIT_DEF
%12:gr64 = IMPLICIT_DEF
%5:gr8 = MOV8rm %12, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s8) from `i8* undef`, align 8)
%13:gr32 = MOV32r0 implicit-def dead $eflags
%14:gr8 = COPY %13.sub_8bit
TEST8rr %14, %14, implicit-def $eflags, debug-location !13
JCC_1 %bb.2, 5, implicit $eflags, debug-location !13
JMP_1 %bb.14, debug-location !13
bb.14:
successors: %bb.2(0x2aaaaaab), %bb.1(0x55555555)
CMP8ri %5, 70, implicit-def $eflags, debug-location !13
JCC_1 %bb.2, 5, implicit $eflags, debug-location !13
JMP_1 %bb.1, debug-location !13
bb.1:
bb.2:
successors: %bb.4(0x20000000), %bb.15(0x60000000)
%4:gr64 = MOV64rm %11, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s64) from `%"class.llvm::Instruction"** undef`)
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !13
%16:gr32 = IMPLICIT_DEF
$edi = COPY %16, debug-location !13
%17:gr64 = IMPLICIT_DEF
CALL64r killed %17, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, implicit-def $al, debug-location !13
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !13
%18:gr8 = COPY $al, debug-location !13
TEST8ri %18, 1, implicit-def $eflags, debug-location !13
JCC_1 %bb.4, 5, implicit $eflags, debug-location !13
JMP_1 %bb.15, debug-location !13
bb.15:
successors: %bb.4(0x2aaaaaab), %bb.3(0x55555555)
CMP8ri %5, 70, implicit-def $eflags, debug-location !13
JCC_1 %bb.4, 4, implicit $eflags, debug-location !13
JMP_1 %bb.3, debug-location !13
bb.3:
bb.4:
successors: %bb.5, %bb.6
%21:gr64 = IMPLICIT_DEF
%20:gr32 = MOVZX32rm8 killed %21, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s8) from `i32* undef`, align 8)
%6:gr32 = nsw DEC32r %20, implicit-def dead $eflags, debug-location !13
CMP32ri8 %6, 5, implicit-def $eflags, debug-location !13
JCC_1 %bb.6, 7, implicit $eflags, debug-location !13
JMP_1 %bb.5, debug-location !13
bb.5:
%24:gr64 = IMPLICIT_DEF
%23:gr32 = MOVZX32rm8 %24, 1, $noreg, 0, $noreg, debug-location !13 :: (load (s8) from `i8* undef`, align 8)
%25:gr32 = nsw ADD32ri8 %23, -22, implicit-def dead $eflags, debug-location !13
ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !13
$edi = COPY %25, debug-location !13
%26:gr64 = IMPLICIT_DEF
CALL64r %26, csr_64, implicit $rsp, implicit $ssp, implicit $edi, implicit-def $rsp, implicit-def $ssp, implicit-def $al, debug-location !13
ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp, debug-location !13
bb.6:
successors: %bb.7(0x0aaaaaab), %bb.16(0x75555555)
%31:gr8 = IMPLICIT_DEF
CMP8ri %31, 40, implicit-def $eflags, debug-location !13
JCC_1 %bb.7, 7, implicit $eflags, debug-location !13
bb.16:
successors: %bb.11(0x2e8ba2ea), %bb.7(0x0ba2e8ba), %bb.12(0x1745d174), %bb.13(0x1745d174), %bb.8(0x1745d174)
%29:gr32 = MOV32r0 implicit-def dead $eflags
%28:gr64_nosp = SUBREG_TO_REG 0, %29, %subreg.sub_32bit
JMP64m $noreg, 8, %28, %jump-table.0, $noreg :: (load (s64) from jump-table)
bb.7:
%43:gr8 = IMPLICIT_DEF
$al = COPY %43
RET 0, $al
bb.8:
successors: %bb.10(0x20000000), %bb.17(0x60000000)
CMP32ri8 %6, 5, implicit-def $eflags, debug-location !13
JCC_1 %bb.10, 7, implicit $eflags, debug-location !13
JMP_1 %bb.17, debug-location !13
bb.17:
successors: %bb.10(0x2aaaaaab), %bb.9(0x55555555)
%3:gr32 = ADD32ri8 %7, -7, implicit-def dead $eflags
CMP32ri8 %3, 3, implicit-def $eflags, debug-location !13
JCC_1 %bb.10, 2, implicit $eflags, debug-location !13
JMP_1 %bb.9, debug-location !13
bb.9:
%41:gr8 = IMPLICIT_DEF
$al = COPY %41
RET 0, $al
bb.10:
%42:gr8 = IMPLICIT_DEF
$al = COPY %42
RET 0, $al
bb.11:
%37:gr64 = IMPLICIT_DEF
MOV8mr killed %37, 1, $noreg, 0, $noreg, %2, debug-location !13 :: (store (s8) into `i8* undef`, align 8)
%38:gr8 = IMPLICIT_DEF
$al = COPY %38
RET 0, $al
bb.12:
%34:gr64 = IMPLICIT_DEF
MOV8mr %34, 1, $noreg, 0, $noreg, %1, debug-location !13 :: (store (s8) into `i8* undef`, align 8)
%35:gr64 = IMPLICIT_DEF
MOV64mr %35, 1, $noreg, 0, $noreg, %4, debug-location !13 :: (store (s64) into `%"class.llvm::Instruction"** undef`)
%36:gr8 = IMPLICIT_DEF
$al = COPY %36
RET 0, $al
bb.13:
DBG_INSTR_REF 1, 0, !12, !DIExpression(), debug-location !13
%32:gr64 = IMPLICIT_DEF
MOV8mr killed %32, 1, $noreg, 0, $noreg, %0, debug-location !13 :: (store (s8) into `i8* undef`, align 8)
%33:gr8 = IMPLICIT_DEF
$al = COPY %33
RET 0, $al
...