[llvm] 8892825 - [AMDGPU] Enable saving SHARED_BASE to VCC (#163244)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 13 13:38:32 PDT 2025


Author: carlobertolli
Date: 2025-10-13T15:38:28-05:00
New Revision: 88928259173ba6fe99b20258fcde512d82b72a46

URL: https://github.com/llvm/llvm-project/commit/88928259173ba6fe99b20258fcde512d82b72a46
DIFF: https://github.com/llvm/llvm-project/commit/88928259173ba6fe99b20258fcde512d82b72a46.diff

LOG: [AMDGPU] Enable saving SHARED_BASE to VCC (#163244)

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
    llvm/test/CodeGen/AMDGPU/sgpr-phys-copy.mir

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index ec5c5bb349ac4..a44a247184ea5 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -899,7 +899,7 @@ void SIInstrInfo::copyPhysReg(MachineBasicBlock &MBB,
     }
 
     if (DestReg == AMDGPU::VCC) {
-      if (AMDGPU::SReg_64RegClass.contains(SrcReg)) {
+      if (AMDGPU::SReg_64_EncodableRegClass.contains(SrcReg)) {
         BuildMI(MBB, MI, DL, get(AMDGPU::S_MOV_B64), AMDGPU::VCC)
           .addReg(SrcReg, getKillRegState(KillSrc));
       } else {

diff  --git a/llvm/test/CodeGen/AMDGPU/sgpr-phys-copy.mir b/llvm/test/CodeGen/AMDGPU/sgpr-phys-copy.mir
index 9553fcc1c51c8..f11fe4aa6e00e 100644
--- a/llvm/test/CodeGen/AMDGPU/sgpr-phys-copy.mir
+++ b/llvm/test/CodeGen/AMDGPU/sgpr-phys-copy.mir
@@ -58,6 +58,15 @@ body:             |
     $sgpr0_sgpr1 = COPY $src_shared_base
 ...
 
+---
+name: src_shared_base_to_vcc
+body:             |
+  bb.0:
+    ; GFX9-LABEL: name: src_shared_base_to_vcc
+    ; GFX9: $vcc = S_MOV_B64 $src_shared_base
+    $vcc = COPY $src_shared_base
+...
+
 ---
 name: sgpr96_aligned_src_dst
 body:             |


        


More information about the llvm-commits mailing list