Skip to content

Commit 0a1f745

Browse files
committed
Enable saving SHARED_BASE to VCC.
This is observed when exhausting scalar registers in kernels with high register usage.
1 parent 7905ec3 commit 0a1f745

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -899,7 +899,8 @@ void SIInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
899899
}
900900

901901
if (DestReg == AMDGPU::VCC) {
902-
if (AMDGPU::SReg_64RegClass.contains(SrcReg)) {
902+
if (AMDGPU::SReg_64RegClass.contains(SrcReg) ||
903+
AMDGPU::SReg_64_EncodableRegClass.contains(SrcReg)) {
903904
BuildMI(MBB, MI, DL, get(AMDGPU::S_MOV_B64), AMDGPU::VCC)
904905
.addReg(SrcReg, getKillRegState(KillSrc));
905906
} else {

llvm/test/CodeGen/AMDGPU/sgpr-phys-copy.mir

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ body: |
5858
$sgpr0_sgpr1 = COPY $src_shared_base
5959
...
6060

61+
---
62+
name: src_shared_base_to_vcc
63+
body: |
64+
bb.0:
65+
; GFX9-LABEL: name: src_shared_base_to_vcc
66+
; GFX9: $vcc = S_MOV_B64 $src_shared_base
67+
$vcc = COPY $src_shared_base
68+
...
69+
6170
---
6271
name: sgpr96_aligned_src_dst
6372
body: |

0 commit comments

Comments
 (0)