[llvm] AMDGPU: Fold mov imm to copy to av_32 class (PR #155428)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 26 16:11:23 PDT 2025


================
@@ -1315,6 +1298,14 @@ void SIFoldOperandsImpl::foldOperand(
       UseMI->setDesc(MovDesc);
 
       if (MovOp == AMDGPU::V_MOV_B16_t16_e64) {
+        // Allow immediates COPYd into sgpr_lo16 to be further folded while
+        // still being legal if not further folded
+        if (DestRC == &AMDGPU::SGPR_LO16RegClass) {
+          assert(ST->useRealTrue16Insts());
+          MRI->setRegClass(DestReg, &AMDGPU::SGPR_32RegClass);
+          DestRC = &AMDGPU::SGPR_32RegClass;
+        }
+
----------------
arsenm wrote:

Moving this down here doesn't make sense, but I did it in a vain effort to avoid the true16 regression 

https://github.com/llvm/llvm-project/pull/155428


More information about the llvm-commits mailing list