# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx906 -run-pass=prologepilog -verify-machineinstrs %s -o - | FileCheck -check-prefix=GCN %s
# VGPR spill code in the prolog sets the `IsKill` flag for the spilled register
# based on the entry block's livein info.
---
name: vgpr_use_after_prolog_spill
tracksRegLiveness: true
machineFunctionInfo:
scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
frameOffsetReg: '$sgpr33'
stackPtrOffsetReg: '$sgpr32'
body: |
bb.0:
liveins: $sgpr42, $vgpr0, $sgpr30_sgpr31
; GCN-LABEL: name: vgpr_use_after_prolog_spill
; GCN: liveins: $sgpr42, $vgpr0, $sgpr30_sgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: $vgpr0 = V_ADD_U32_e32 8192, killed $vgpr0, implicit $exec
; GCN-NEXT: $vgpr0 = V_WRITELANE_B32 killed $sgpr42, 0, $vgpr0
; GCN-NEXT: S_NOP 0, implicit-def $vgpr0
; GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31
$vgpr0 = V_ADD_U32_e32 8192, killed $vgpr0, implicit $exec
$vgpr0 = V_WRITELANE_B32 killed $sgpr42, 0, $vgpr0
S_NOP 0, implicit-def $vgpr0
S_SETPC_B64_return $sgpr30_sgpr31
...
---
name: livein_vgpr_def_after_prolog_spill
tracksRegLiveness: true
machineFunctionInfo:
scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
frameOffsetReg: '$sgpr33'
stackPtrOffsetReg: '$sgpr32'
body: |
bb.0:
liveins: $sgpr42, $vgpr0, $vgpr1, $sgpr30_sgpr31
; GCN-LABEL: name: livein_vgpr_def_after_prolog_spill
; GCN: liveins: $sgpr42, $vgpr0, $vgpr1, $sgpr30_sgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: $vgpr0 = V_ADD_U32_e32 8192, killed $vgpr1, implicit $exec
; GCN-NEXT: $vgpr0 = V_WRITELANE_B32 killed $sgpr42, 0, $vgpr0
; GCN-NEXT: S_NOP 0, implicit-def $vgpr0
; GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31
$vgpr0 = V_ADD_U32_e32 8192, killed $vgpr1, implicit $exec
$vgpr0 = V_WRITELANE_B32 killed $sgpr42, 0, $vgpr0
S_NOP 0, implicit-def $vgpr0
S_SETPC_B64_return $sgpr30_sgpr31
...
---
name: livein_vgpr_not_referred_in_entry_bb
tracksRegLiveness: true
machineFunctionInfo:
scratchRSrcReg: '$sgpr0_sgpr1_sgpr2_sgpr3'
frameOffsetReg: '$sgpr33'
stackPtrOffsetReg: '$sgpr32'
body: |
; GCN-LABEL: name: livein_vgpr_not_referred_in_entry_bb
; GCN: bb.0:
; GCN-NEXT: successors: %bb.1(0x80000000)
; GCN-NEXT: liveins: $sgpr42, $vgpr0, $sgpr30_sgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: S_NOP 0
; GCN-NEXT: S_BRANCH %bb.1
; GCN-NEXT: {{ $}}
; GCN-NEXT: bb.1:
; GCN-NEXT: liveins: $sgpr42, $vgpr0, $sgpr30_sgpr31
; GCN-NEXT: {{ $}}
; GCN-NEXT: $vgpr0 = V_WRITELANE_B32 killed $sgpr42, 0, $vgpr0
; GCN-NEXT: S_NOP 0, implicit-def $vgpr0
; GCN-NEXT: S_SETPC_B64_return $sgpr30_sgpr31
bb.0:
liveins: $sgpr42, $vgpr0, $sgpr30_sgpr31
S_NOP 0
S_BRANCH %bb.1
bb.1:
liveins: $sgpr42, $vgpr0, $sgpr30_sgpr31
$vgpr0 = V_WRITELANE_B32 killed $sgpr42, 0, $vgpr0
S_NOP 0, implicit-def $vgpr0
S_SETPC_B64_return $sgpr30_sgpr31
...