[llvm] [AMDGPU] Allow folding of non-subregs through REG_SEQUENCE (PR #151033)

Josh Hutton via llvm-commits llvm-commits at lists.llvm.org
Fri Oct 10 10:53:48 PDT 2025


================
@@ -726,7 +731,9 @@ bool SIFoldOperandsImpl::updateOperand(FoldCandidate &Fold) const {
 
   // Rework once the VS_16 register class is updated to include proper
   // 16-bit SGPRs instead of 32-bit ones.
-  if (Old.getSubReg() == AMDGPU::lo16 && TRI->isSGPRReg(*MRI, New->getReg()))
+  if ((Old.getSubReg() == AMDGPU::lo16 &&
+       TRI->isSGPRReg(*MRI, New->getReg())) ||
+      !New->getSubReg())
     Old.setSubReg(AMDGPU::NoSubRegister);
----------------
JoshHuttonCode wrote:

It seems like this will change the behavior of the 16-bit SGPR path. Is that right, and should it be a separate PR?

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


More information about the llvm-commits mailing list